运行时错误:无法加载文件或程序集"Microsoft.Owin,版本=3.0.0.0....Azure 移动服务



我在创建移动服务后从Azure managementprotal下载了ToDOService项目。最初它有很多错误,因为Nuget包已经过时了。我卸载了Azure mobile services .net backend包及其依赖项。后来我再次手动安装所有包,然后我可以成功构建项目。不知何故,当我运行服务项目时,我收到此错误:-

Could not load file or assembly 'Microsoft.Owin, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Owin, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source Error: 

Line 18: 
Line 19:             // Use this class to set WebAPI configuration options
Line 20:             HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));
Line 21: 
Line 22:             // To display errors in the browser during development, uncomment the following
Source File: ...MyProjectMyServiceApp_StartWebApiConfig.cs    Line: 20

我的 web.config 看起来像这样

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

我还尝试将程序集更新到最新版本,但由于 Ver 3.0.1 与其其他依赖项不兼容,因此无法更新。

任何帮助将不胜感激。谢谢

我也遇到过这个问题,这篇博文说,当 SignalR 或 Web API 应用程序以辅助角色运行时,就会发生这种情况。对我来说,此错误发生在我运行作为解决方案一部分的控制台应用程序之后......下次我尝试访问项目中使用 Web API 的 Web 应用程序时,我会看到黄屏死机。

博客文章中提到的修复不起作用,您的 web.config 似乎指定了正确的版本信息。听起来这仍然是 NuGet 包的问题。

我们遇到了类似的问题,并且通过将 Microsoft.Owin 更新到最新版本(撰写此版本 3.0.1.0 的时间)解决了这个问题。

您可以使用包管理器控制台升级包,然后键入:"安装包Microsoft.Owin"

希望对您有所帮助。

最新更新