Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35'

I had the same issue today during deployment. I was able to fix it by marking the assembly to be copied to the deployment file.

In order to do this, in my Visual Studio project, select the System.Web.Http.Webhost assembly in your references and alter the 'Copy Local' property to True. I had to repeat this for a few other assemblies that were missing.

Thanks to this website for the tips - http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx/


Check the bin folder of your deployed project. It should contain System.Web.Http.WebHost.dll. If this dll is in this folder, check it version. If it isn't 4.0.0.0, then you should deploy version 4.0.0.0 or change your web config to use other version (not really good idea because of dependencies)


Try to reinstall Microsoft.AspNet.WebApi package. Open Package Manager Console and type:

Update-Package Microsoft.AspNet.WebApi -reinstall

Be careful, this command will remove all dependencies and you will have to install them manually.