Could not load file or assembly 'System.Net.Http' or one of its dependencies


Maybe Relevant information: I have a web application I built with .net 4.5. I wanted to deploy to Azure's Web Sites but it only supports .net 4.0 so I downgraded the project to .net 4.0. It still works when run locally.

When I publish to Azure, i get this error:

Could not load file or assembly 'System.Net.Http' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have tried removing the Web API with nuget and readding it, as another question on SO suggested but I still have the same problem.
I have tried close/open VS, and clean/build.

asked on Stack Overflow Sep 2, 2012 by Kyle • edited Sep 8, 2016 by Ehsan Sajjad

6 Answers


I solved a similar problem (System.Web.Http and System.Net.Http.Formatting) error by removing the reference to problem reference (which was pointed to my .Net installation folder) and replacing it with the reference file in my packages folder that was installed by the Microsoft.AspNet.WebApi NuGet package.

answered on Stack Overflow Oct 5, 2013 by Josh C

I had the same problem. However, updating assembly versions, copy local, and specific version settings alone did not solve my problem. In my application configuration I deploy a web and a worker role to a cloud service. After creating the service, on the configure tab I set the Operating System to Windows Server 2012 R2 to get the support for .Net Framework 4.5.1. But the error still occured.

Upon further research, I found that the *.cscfg file for my cloud service overrode the portal setting with an obscure osFamily setting of "3". When I started my project it was on MVC3 and did not yet have WebAPI and framework 4.5.1. osFamily 3 was the latest at the time.

In my latest deployment I had upgraded my site to 4.5.1 framework and MVC5. I verified it worked locally on my development machine. But it didn't work after deployment with the error referencing System.Net.Http.Formatting version not being found. I later saw the deployment log that showed the source error

"The feature named NetFx451 that is required by the uploaded package is not available in the OS * chosen for the deployment."

Here is the blog article that led me to the solution to change the osFamily setting to 4. Then my site worked after a fresh deployment.

answered on Stack Overflow Oct 28, 2014 by Michael Lang

System.NET.HTTP.dll only depends on System.dll, System.Core.dll and mscorlib.dll.

Make sure you have this DLL (System.NET.HTTP.dll) in your deployment package (you can do RDP connect and check deployment folder). Play with "Copy to Local" property of reference, or include this dll in your project on root level and set type "content" in properties.

Also System.Net.Http.dll is also supported for .NET 2.0 as i see - that might cause an issue. So additionally to above try to set property of reference "Specific version" = true

answered on Stack Overflow Sep 3, 2012 by Philipp Munin

Azure Now supports .Net 4.5 on the configuration tab you can select .Net framework version V3.5 or V4.5 I have several MVC Web Apps with Numerous supporting DLLs all all compiled in V4.5. What Azure does not support is V 4.5.1 (from the VS 2013 RC release).

answered on Stack Overflow Oct 5, 2013 by Code Uniquely

I had the same issue with an application with some Web Jobs which deployed to the same Azure App Service. It was solved by referencing the same System.Net.Http (nuget package) from all projects.

answered on Stack Overflow Oct 15, 2018 by user2694420

If all of the options you did didn't work, please try restarting (close / open as "admin") your visual studio, then clean / rebuild. This has fixed my problem.

Though this is only for my local machine, haven't tried yet with other environments like in azure or in any server.

I had the same experience with missing System.Net.Http issue.

answered on Stack Overflow Oct 6, 2020 by Clyde

User contributions licensed under CC BY-SA 3.0