项目在本地工作但在Azure上崩溃

Run*_*une 5 asp.net azure asp.net-web-api

我刚刚将我的项目发布到Azure,突然间我收到以下错误:

无法加载文件或程序集'System.Web.Cors,Version = 5.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

自上次发布以来,我没有更新/安装任何nuget包.此外,我刚刚检查了.dkk文件,并将copy local设置为true.

这可能是什么问题?我没有改变任何事情.

在sitenode我的项目在当地工作正常.

Abh*_*pta 4

这肯定是因为您的 DLL 版本不同或该环境中缺少 DLL。

您需要检查几个步骤:

  • Cors DLL 应该位于您的 BIN 目录中 [在 Azure 上]

  • 如果存在,那么服务器上部署的 DLL 版本和本地版本应该相同。[您可以查看属性]

  • 如果您的 Cors DLL 版本在 Azure 服务器上较高,请与本地版本进行比较,然后您可以
<dependentAssembly>
   <assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" />
   <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.1" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

您的新版本可能是您的 DLL 版本,可在 BIN 目录中找到。