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

时间:2015-04-20 04:46:20

标签: c# .net azure owin azure-mobile-services

我在创建移动服务后从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: ...\MyProject\MyService\App_Start\WebApiConfig.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与其他依赖项不兼容。

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

2 个答案:

答案 0 :(得分:0)

我也遇到过这个问题,this blog post说当SignalR或Web API应用程序以worker角色运行时会发生这种情况。对我来说,这个错误发生在我运行作为我的解决方案一部分的控制台应用程序之后......下次我尝试访问使用Web API的项目中的Web应用程序时,我得到了死亡的黄色屏幕。

博客文章中提到的修补程序不起作用,看来您的web.config具有指定的正确版本信息。听起来这仍然是NuGet包的一个问题。

答案 1 :(得分:0)

我们有类似的问题,并且通过将Microsoft.Owin更新到最新版本(编写此版本3.0.1.0的时间)来解决问题显然很有用。

您可以使用包管理器控制台升级包,然后键入: “Install-Package Microsoft.Owin”

希望它有所帮助。