代码之家  ›  专栏  ›  技术社区  ›  Juho Rutila

在Azure应用程序服务中解决.NET类型加载异常

  •  0
  • Juho Rutila  · 技术社区  · 7 年前

    我有一个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日志查看器。

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

    浏览: How to enable assembly bind failure logging (Fusion) in .NET 但它并没有说明在Azure应用程序服务中做什么。

    1 回复  |  直到 7 年前
        1
  •  1
  •   axfd    7 年前

    现在无法在Azure应用程序服务中获取融合日志。因为需要修改注册表才能启用它。但在Azure应用程序服务中不允许修改注册表。参照 here 更多信息。

    错误“定位的程序集的清单定义与程序集引用不匹配”。通常表示运行时找到的程序集与应用程序中指定的程序集不匹配。

    在Azure Web应用程序中,您可以通过ftp检查dll。“检查” Accessing files via ftp “。DLL通常位于 \wwwroot\bin . 确认dll信息与解决方案中使用的dll匹配。您可以检查web.config和package.config是否为此程序集指定了不同的版本。

    也指 here 了解.NET运行时如何定位dll。

    推荐文章