gpt4 book ai didi

asp.net - 无法在 Azure 上加载文件或程序集 Microsoft.Owin

转载 作者:行者123 更新时间:2023-12-02 19:48:08 25 4
gpt4 key购买 nike

我的 ASP.Net MVC 应用程序在 IIS 上本地运行时工作正常,但在部署到 Azure 时出现以下错误:

Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

这是堆栈跟踪的一部分,让我相信 SignalR 是潜在的罪魁祸首:

[FileLoadException: Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
Owin.OwinExtensions.MapSignalR(IAppBuilder builder, String path, HubConfiguration configuration) +0
Owin.OwinExtensions.MapSignalR(IAppBuilder builder, HubConfiguration configuration) +12
QuikWorx.O365Web.Startup.Configuration(IAppBuilder app) +169

根据 NuGet,我在应用程序上安装了 Microsoft.Owin 3.0.1 版本,但显然某些东西(SignalR)需要 2.1.0 版本。我本以为以下绑定(bind)重定向会强制 SignalR 使用已安装的版本 3.0.1(已验证存在,版本 3.0.1 在 Azure 上的/bin 中):

  <dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>

...但可惜,事实并非如此。

我还尝试了以下方法但没有成功:

  • 使用 NuGet 强制重新安装 Microsoft.Owin 3.0.1。
  • 强制重新安装需要 Microsoft.Owin 2.1.0 和 NuGet 的 SignalR 组件 (Microsoft.AspNet.SignalR.Core)
  • 将 Microsoft.Owin 的绑定(bind)重定向的旧版本更改为“0.0.0.0-2.1.0.0”(这没有意义)
  • 删除 Microsoft.Owin 的绑定(bind)重定向
  • 使用 Kudu 中的 rd/Q/S 删除站点目录中的所有文件和文件夹

还有什么我可以尝试的吗?

最佳答案

很想找到问题的根本原因,比如为什么它可以在本地工作,但不能在 Azure 中工作,而是基于此 answer您可能应该尝试通过 NuGet 将 Microsoft OWIN 本身安装到失败的项目中。

关于asp.net - 无法在 Azure 上加载文件或程序集 Microsoft.Owin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44837717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com