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.

相关文章

目录简介使用JS互操作使用ClipLazor库创建项目使用方法简单测...
目录简介快速入门安装 NuGet 包实体类User数据库类DbFactory...
本文实现一个简单的配置类,原理比较简单,适用于一些小型项...
C#中Description特性主要用于枚举和属性,方法比较简单,记录...
[TOC] # 原理简介 本文参考[C#/WPF/WinForm/程序实现软件开机...
目录简介获取 HTML 文档解析 HTML 文档测试补充:使用 CSS 选...