Could not load file or assembly #39;System.Net.Http, Version=2.0.0.0 in MVC4 Web API(无法在 MVC4 Web API 中加载文件或程序集 System.Net.Http,版本 = 2.0.0.0)
问题描述
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:
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)
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
Funny enough, the version of System.Net.Http that I locally have either in my package folder or in the ASP.NET MVC 4Assemblies 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.
Looking at the nuget dependencies:
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
Am I missing something?
UPDATE:
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.
I had the same problem with deployment my app to appharbor. The problem it does not support .NET 4.5 yet. What I did.
- Switched my project to .NET 4.0 profile.
- Uninstalled Web API NuGet package.
- Installed Web API (Beta) NuGet package again.
- Verified that .csproj file contains for ALL referenced assemblies, so it will always take it from Bin folder, instead of GAC.
这篇关于无法在 MVC4 Web API 中加载文件或程序集 'System.Net.Http,版本 = 2.0.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无法在 MVC4 Web API 中加载文件或程序集 'System.Net.Http,版本 = 2.0.0.0
基础教程推荐
- 将 XML 转换为通用列表 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30