首页 > 解决方案 > 解决 Azure 应用服务中的 .NET TypeLoadExceptions

问题描述

我有一个 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].

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

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

浏览此内容:How to enable assembly bind failure logging (Fusion) in .NET,但它没有说明在 Azure App Service 中执行此操作。

标签: asp.net.netazureassembliesazure-web-app-service

解决方案


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

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


推荐阅读