3

Possible Duplicate:
Could not load file or assembly 'System.Net.Http, Version=2.0.0.0 in MVC4 Web API

I have created a .net mvc 4 project in vs11. I have set the runtime to 4.0 and deployed the app to appharbor. When I run the application I get "Could not load file or assembly 'System.Net.Http' or one of its dependencies.".

Any ideas?

If I remove the reference to this assembly the application works but if I try to use the new web api features it crashes with the same message (of course).

It should be possible to run the web api features on a .NET 4.0 runtime right?

EDIT: I see that when I get the properties on the system.net.http.dll it says version 1.0.0.0 and in the reference in VS it says 2.0.0.0. Could this be the reason why it does not load?

Community
  • 1
  • 1
Magnus O.
  • 468
  • 5
  • 17

2 Answers2

2

"It should be possible to run the web api features on a .NET 4.0 runtime right?"

Yes.

Have you tried installing it by Nuget?

http://nuget.org/packages/AspNetWebApi

John Korsnes
  • 2,277
  • 2
  • 20
  • 31
  • Yes, I installed it via nuget and all the DLL's are there, that why I think it should work. – Magnus O. Mar 06 '12 at 13:44
  • Also, if you are deploying to Appharbor I recommend using the NuGet package restore option :) http://blog.appharbor.com/2012/2/06/use-nuget-package-restore-to-avoid-pushing-packages-to-appharbor I had similar problems on a MVC 3 app using the AspNetWebApi package , while hosting on AppHarbor. Hope it works out :) – John Korsnes Mar 07 '12 at 15:07
  • Tried the restore option aswell... no luck :) – Magnus O. Mar 08 '12 at 07:18
  • I don't have internet connectivity. How can I get the AspNetWebApi package? – Matt Feb 07 '13 at 20:21
0

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. Switched my project to .NET 4.0 profile.
  2. Uninstalled Web API NuGet package.
  3. Installed Web API (Beta) NuGet package again.
  4. Verified that .csproj file contains for ALL referenced assemblies, so it will always take it from Bin folder, instead of GAC.
Alexander Beletsky
  • 19,453
  • 9
  • 63
  • 86