1

I'm struggling to have my application working after deploy to Windows 2003 server. After some investigation it seems that I have a problem with the way application is build/published or configured. This is what happens:

  • on my developers machine I have a MVC4 project (targets .NET 4 and ASP .NET 4). Everything runs smoothly. I have many NuGet packages referenced by the project. And one of them is

packages\Microsoft.Net.Http.2.2.15\lib\net40\System.Net.Http.dll

  • after deploying the application to Windows 2003 server, and (I hope) properly configuring IIS etc I get the following exception:

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

And I don't know what is happening. I've checked bin folder on the server and I can see System.Net.Http.dll dll with version 2.2.15. So why application is trying to load System.Net.Http.dll with version 2.0.0

dragonfly
  • 17,407
  • 30
  • 110
  • 219

1 Answers1

0

I believe that the System.Net.Http.dll it's based on .Net 4.5 that's not supported on Windows 2003 and 2003 R2 (as crazy as it sounds)

https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2723735-make-net-4-5-work-on-any-os-that-supports-4-0

Check out your dependencies and remove System.Net.Http.dll if you can or, since 4.5 it's an inplace replacement for 4.0 maybe you will need to remove 4.5 from your dev environment

Check out this other SO question: Could not load file or assembly 'System.Net.Http, Version=2.0.0.0 in MVC4 Web API

Community
  • 1
  • 1
Eduardo Molteni
  • 38,786
  • 23
  • 141
  • 206