微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – Azure webrole循环和“无法加载文件或程序集System.Web.Http 5.2.0.0”

我再也无法部署我的天蓝色webrole,它无限循环.所以我穿上了Intellitrace,我发现了这个异常:

Exception:Thrown: “Unable to load the role entry point due to the
following exceptions:
— System.IO.FileLoadException: Could not load file or assembly ‘System.Web.Http,Version=5.0.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)

在我的项目中,web.config和包(Webapi,webhost等)都在5.2.0.0中,所以我不明白为什么Azure试图找到5.0.0.0?

例:

<dependentAssembly>
    <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
</dependentAssembly>

你有什么主意吗 ?谢谢

ps:System.Web.Http得到了本地复制:true

解决方法

intellitrace输出告诉你WaIISHost.exe崩溃(“无法加载角色入口点”).但是您的web.config程序集绑定重定向仅影响w3wp.exe进程.你有几个选择:

>检查角色入口点(从RoleEntryPoint派生的类,通常是Webrole.cs),以确保引用System.Web 5.2 DLL.>使用绑定重定向为WaIISHost进程创建.config文件.为此,您将创建一个.dll.config.在认Web角色项目中,这将是Webrole1.dll.config.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐