无法加载文件或程序集“System.Net.Http,版本= 2.0.0.0在MVC4的Web API [英] Could not load file or assembly 'System.Net.Http, Version=2.0.0.0 in MVC4 Web API

查看:1478
本文介绍了无法加载文件或程序集“System.Net.Http,版本= 2.0.0.0在MVC4的Web API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一点怪异的问题。结果
我开发一个应用程序使用MVC 4和新的Web API,并在本地工作正常。
我在服务器上安装MVC4和部署应用程序。现在,我得到以下错误:

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:

无法加载文件或程序集System.Net.Http,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35或它的一个依赖。找到的程序集清单定义不匹配程序集引用。 (异常来自HRESULT:0x80131040)

Could not load file or assembly 'System.Net.Http, Version=2.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请求的执行过程中发生未处理的异常。请检查堆栈跟踪有关该错误的详细信息以及它起源于

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

有趣的是,System.Net.Http的版本,我在当地无论是在我的包文件夹或ASP.NET MVC 4 \\文件夹大会已经是1.0.0.0。
其实,我删除了我的项目参考System.Net.Http,但我仍然得到了同样的信息。我有点困惑那里得到来自2.0.0.0参考,为什么它会在本地而不是工作在服务器上。

Funny enough, the version of System.Net.Http that I locally have either in my package folder or in the ASP.NET MVC 4\Assemblies folder is 1.0.0.0. I actually removed the reference to System.Net.Http from my project, but I still get the same message. I'm a bit confused about where it gets the 2.0.0.0 reference from and why it would work locally but not on the server.

综观的NuGet依赖关系:

Looking at the nuget dependencies:

的ASP.NET Web API核心库(测试版)取决于System.Net.Http.Formatting。结果
而System.Net.Http.Formatting取决于System.Net.Http。结果
我想这就是这从何而来。但我确实有这个安装包版本2.0.20126.16343,它只是该dll内部有1.0.0.0版

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

我缺少的东西吗?

更新:

这是另一个ASP.NET应用程序的一个子应用程序,但另一个仍然基于的WebForms。那么,事情是越来越乱了。但是,如果我做一个干净的下组装部件在web.config如果它甚至找不到应用程序本身了。

This is a sub-application of another ASP.NET app, but the other one is still based on WebForms. So, something is getting messed up. But if I do a clean under the assembly section in the web.config if does not even find the app itself anymore.

推荐答案

我有同样的问题,部署我的应用程序appharbor。这个问题它不支持.NET 4.5呢。我所做的。

I had the same problem with deployment my app to appharbor. The problem it does not support .NET 4.5 yet. What I did.


  1. 交换我的项目.NET 4.0配置文件。

  2. 卸载的Web API的NuGet包。

  3. 再次
  4. 安装的Web API(测试版)的NuGet包。

  5. 已验证的.csproj文件包含所有引用的程序,所以它总是把它从Bin文件夹,而不是GAC。

这篇关于无法加载文件或程序集“System.Net.Http,版本= 2.0.0.0在MVC4的Web API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆