解决 Azure 应用服务中的 .NET TypeLoadException

Juh*_*ila 4 .net asp.net assemblies azure azure-web-app-service

我有一个 Azure 应用服务,我在其中发布了 .NET 应用程序 (.NET Framework 4.7.2)。该应用程序在本地 Visual Studio IIS Express 上运行良好。

当我在应用程序服务中运行它时,我收到 TypeLoadExceptions。例如,有趣的部分是这些错误:

    - System.IO.FileLoadException: Could not load file or assembly 'EPiServer.Forms, Version=3.0.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'EPiServer.Forms, Version=3.0.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Run Code Online (Sandbox Code Playgroud)

现在,在任何虚拟服务器情况下,我都可以启用 EnableLog 注册表值并查看有关我缺少的依赖项的更多信息。我尝试通过 PowerShell 更改注册表值,但访问被拒绝。我在 Azure 中也没有找到任何 Fusion Log 查看器。

在 Azure 应用服务中调试程序集绑定错误的正确方法是什么?

浏览此:如何在.NET中启用程序集绑定失败日志记录(Fusion),但它没有说明有关在Azure应用程序服务中执行此操作的任何信息。

ang*_*olt 8

只是想发布一个更新,说明现在可以启用 Azure 应用程序服务上的融合日志记录,这里有一篇文章

基本上,您所要做的就是添加一个名为 WEBSITE_FUSIONLOGGING_ENABLED 的应用程序设置并将其设置为 1。