I did the upgrade according to. http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
I get the er
Or you could do this from NuGet Package Manager Console
Install-Package Microsoft.AspNet.WebApi -Version 5.0.0
And then you will be able to add the reference to System.Web.Http.WebHost 5.0
I had same problem and reinstalling package doesn't work.
My application runs in LocalIIS(not IIS EXPRESS). I enable Assembly Load Trace and find out it want load System.Web.Http load from below temp catche. so remove all catch folders in it.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files[my application]
I could solve similar problem with System.Net.HTTP by adding assembly reference in app.config of main application.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.0.0.0" />
</dependentAssembly></runtime>
I simply set Copy Local = true
on the missing assembly and that worked. This of course happens by right clicking on the missing reference (which is stated in the error message) and selecting properties; as below:
This should then solve one problem as there might be more than one assembly causing the issue - what I did is I selected all assemblies and right click on them; selected properties; and set them all to Copy Local = true; and then republish.
YES!!!
Install-Package Microsoft.AspNet.WebApi -Version 5.0.0
It works fine in my case....thnkz
I got this issue when deploying to Azure using the Publish feature. Remember to clear files at destination.
Publish Settings -> File Publish Options drop down -> Check Remove additional files at destination
This solved my issue, in case people have to hunt around for this like I did. Everything was the same version in my project/solution, just not at the destination I was deploying to.