I have a bit of a weird problem.
I developed an app with MVC 4 and the new Web API and it works fine locally. I installed MVC4 on the server and deployed the app. Now I get the following error:

无法加载文件或程序集的系统.网Http,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35'或其依赖项之一.定位的程序集 list 定义与程序集引用不匹配.(HRESULT的例外:0x8013100)

描述:当前Web请求执行过程中发生未经处理的异常.有关错误及其来源的详细信息,请查看堆栈跟踪

有趣的是,这个版本的系统.网我在本地的包文件夹或ASP.NET MVC 4\Assemblys文件夹为1.0.0.0.

查看nuget依赖项:

ASP.NET WEb API Core Libraries (Beta) depends on System.Net.Http.Formatting.
And System.Net.Http.Formatting depends on System.Net.Http.
I guess that is where this comes from. But I do have Version 2.0.20126.16343 of this package installed, it's just that the dll inside has version 1.0.0.0

我错过什么了吗?

UPDATE:

这是另一个ASP的子应用程序.NET应用程序,但另一个仍然基于WebForms.所以,有些事情搞砸了.但如果我在网页的组装部分下做一个清理.config if甚至找不到应用程序本身.

推荐答案

我在将我的应用部署到appharbor时也遇到了同样的问题.它不支持的问题.净4.5还没有.我所做的.

  1. 把我的项目改成了.NET 4.0配置文件.
  2. 已卸载Web API NuGet软件包.
  3. 再次安装Web API(Beta)NuGet包.
  4. 证实了这一点.csproj文件包含所有引用的程序集,因此它将始终从Bin文件夹而不是GAC中获取它.

Asp.net相关问答推荐

Visual Studio发布的网站得到错误类型JObject is not defined when page is load on server"''"

ASP .Net Web API 将图像下载为二进制

你能从请求变量中确定时区吗?

我应该使用字节还是整数?

如何使用 jQuery 设置 outerHTML

SameSite 属性如何自动添加到我的 Asp.net_SessionID cookie 中?

无法让嵌套在 UpdatePanel 中的 WebControl 中的 ScriptManager.RegisterStartupScript 工作

Request.Params 和 Request.Form 什么时候不同?

IIS 6.0 通配符映射基准?

通过 jQuery 调用 ASP.NET 服务器端方法

如何从 Asp.net Mvc-3 发送邮箱?

单击按钮时播放哔声

如何在 ASP.NET 中设置下拉列表项?

MVC3 值 Ajax 文件上传

删除 HTML 或 ASPX 扩展

ASP.NET MVC 路由的无限 URL 参数

在资源文件中使用 HTML

使 WCF Web 服务与 GET 请求一起工作

盒式磁带包与 MVC4 包

如何检索 X509Store 中的所有证书