I created a web project and it runs well in Visual studio. However, I got the following error after published it to azurewebsites. What can cause the issue?
For me worked adding the following section to web.config
file:
<configuration>
...
<runtime>
...
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
...
</runtime>
...
</configuration>
This example stands for MVC 5.1. Hope it will help someone to resolve such issue.
I got the same error and I changed my version from 4 to 3 and it is solved:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- Ensure correct version of MVC -->
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
I'm using vs2012 and i think the update KB2781514 changed some setting. All my System.Web.Http in my MVC4 project changed to false and i keeping received this message. I had changed the All file in this project
in publish property but its not working. Finally I have to change Copy Local = true
one by one and solved this problem.
The dll
is missing in the published (deployed environment). That is the reason why it is working in the local i.e. Visual Studio but not in the Azure Website Environment.
Just do Copy Local = true
in the properties for the assembly(System.Web.Http.WebHost) and then do a redeploy, it should work fine.
If you get the similar error i.e. some other assembly missing, then make that assembly to copylocal=true and redeploy, repeat this iteratively - if you are unsure of its dependencies.
I removed the following entry from web.config and it worked for me.
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" culture="neutral" publicKeyToken="31BF3856AD364E35" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.2.6.0" />
</dependentAssembly>
I had the same problem in my Application.
System.web.http.webhost not found.
You just need to copy the system.web.http.webhost
file from your main project which you run in Visual Studio and paste it into your published project bin
directory.
After this it may show the same error but the directory name is changed it may be system.web.http
. Follow same procedure as above. It will work after all the files are uploaded. This due to the nuget package in Visual Studio they download from the internet but on server it not able to download it.
You can find this file in your project bin
directory.