简体   繁体   中英

Azure webrole cycling and “Could not load file or assembly System.Web.Http 5.2.0.0”

I can't deploy my azure webrole anymore, it's cycling indefinitly. So I put on Intellitrace and I found this exception :

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

In my project, web.config and package (Webapi, webhost etc.) are all in 5.2.0.0 so I don't understand why Azure try 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 any idea ? Thanks

ps: System.Web.Http got copy local:true

That intellitrace output is telling you that WaIISHost.exe is crashing ("Unable to load the role entry point"). But your web.config assembly binding redirect is only affecting the w3wp.exe process. You have a couple options:

  1. Check your role entry point (the class that derives from RoleEntryPoint, typically WebRole.cs) to make sure you are referencing System.Web 5.2 DLLs.
  2. Create a .config file with your binding redirect for the WaIISHost process. To do this you would create a .dll.config. In a default web role project this would be WebRole1.dll.config.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM