Azure webrole cycling and "Failed to load file or assembly System.Web.Http 5.2.0.0"

I can’t deploy my azure webrole anymore, it cycles on a bicycle. So I put on Intellitrace and I found this exception:

Exception: Thrown: "The role entry point could not be loaded due to the following exceptions: - System.IO.FileLoadException: could not load the file or assembly" System.Web.Http, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 'or one of its dependencies. The installed assembly manifest definition does not match the Help assembly. (Exception from HRESULT: 0x80131040)

In my project, web.config and the package (Webapi, webhost, etc.) are in 5.2.0.0, so I don’t understand why Azure is trying to find 5.0.0.0 ?!

Example:

<dependentAssembly> <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" /> </dependentAssembly> 

Do you have an idea? Thanks

ps: System.Web.Http received a local copy: true

+3
c # asp.net-web-api azure azure-web-roles
source share
1 answer

This intellitrace output tells you that WaIISHost.exe failed ("Unable to load role entry point"). But redirecting the web.config assembly binding only affects the w3wp.exe process. You have several options:

  • Check your role entry point (a class that comes from RoleEntryPoint, usually WebRole.cs) to make sure you reference the System.Web 5.2 DLL.
  • Create a .config file with a binding redirect for the WaIISHost process. For this you would create .dll.config. In the default web role project, this will be WebRole1.dll.config.
+6
source

All Articles