asp.net - 解决 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 中执行此操作。
解决方案
只是想发布一个更新,说明现在可以启用 Azure App 服务上的 Fusion 日志记录,这里有一篇文章。
基本上,您所要做的就是添加一个名为 WEBSITE_FUSIONLOGGING_ENABLED 的应用程序设置并将其设置为 1。
推荐阅读
- html - 在我的桌子之间不需要的空格
- python - 运行 python 调度程序脚本时,docker-compose up 卡在附加到
- sql - 从集成服务目录导出 SSIS 项目时出错
- opencv - 如何在书架的图像中分割单本书籍
- node.js - Twilio SMS 排队但未发送,出现错误代码:30005
- javascript - 拖动地图时移动的传单缩放控件
- r - R中带有sampleSelection的内生切换回归模型(两步)
- javascript - 如何使用反应导航在屏幕之间切换?
- .htaccess - How do I rewrite this URL for .htaccess?
- elasticsearch - 如何过滤或排除 ElasticSearch 中的错误字段?