azure - Web role failing to start because dependent assembly cannot be loaded -


i encountered strange issue startup of web roles. full repro quite complex, managed find root cause put simplified steps.

my webrole project depends on assmeblya in turn depends on assemblyb, version=1.0. webrole depends directly on assemblyb, version=2.0. (this comes different nuget packages on don't have control).

in end, assemblyb, version=2.0 getting copied \bin folder. website working correctly because in web.config there binding redirect assemblyb version=2.0 (which automatically being put there nuget client).

however, when webrole deployed azure, fails start because assemblyb, version=1.0 cannot loaded.

i suspect because web role first loaded approot directory web.config has no effect. found can workaround problem generating app.config web-role , duplicating binding redirects there. while works, it's not convenient maintain such setup.

does know if known issue azure web roles?

tried azure sdk 2.4 , 2.5.1, azure nuget packages date, no custom startup code whatsoever.

update: here exception obtained through intellitrace:

unable load role entry point due following exceptions: -- system.io.fileloadexception:

could not load file or assembly 'microsoft.owin, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) file name: 'microsoft.owin, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'

and here stack trace:

commonlanguageruntimelibrary!system.reflection.runtimemodule.gettypes()  commonlanguageruntimelibrary!system.reflection.assembly.gettypes()   microsoft.windowsazure.serviceruntime.dll!microsoft.windowsazure.serviceruntime.roleenvironment.getroleentrypoint(system.reflection.assembly entrypointassembly = {system.reflection.runtimeassembly})   microsoft.windowsazure.serviceruntime.dll!microsoft.windowsazure.serviceruntime.roleenvironment.createroleentrypoint(microsoft.windowsazure.serviceruntime.implementation.loader.roletype roletypeenum = iisweb)     microsoft.windowsazure.serviceruntime.dll!microsoft.windowsazure.serviceruntime.roleenvironment.initializeroleinternal(microsoft.windowsazure.serviceruntime.implementation.loader.roletype roletypeenum = iisweb)   microsoft.windowsazure.serviceruntime.dll!microsoft.windowsazure.serviceruntime.roleenvironment.initializerole(microsoft.windowsazure.serviceruntime.implementation.loader.roletype roletype = iisweb)   microsoft.windowsazure.serviceruntime.dll!microsoft.windowsazure.serviceruntime.implementation.loader.roleruntimebridge.anonymousmethod()    commonlanguageruntimelibrary!system.threading.executioncontext.runinternal(system.threading.executioncontext executioncontext = {unknown}, system.threading.contextcallback callback = {unknown}, object state = {unknown}, bool preservesyncctx = {unknown})    commonlanguageruntimelibrary!system.threading.executioncontext.run(system.threading.executioncontext executioncontext = {unknown}, system.threading.contextcallback callback = {unknown}, object state = {unknown}, bool preservesyncctx = {unknown})    commonlanguageruntimelibrary!system.threading.executioncontext.run(system.threading.executioncontext executioncontext = {unknown}, system.threading.contextcallback callback = {unknown}, object state = {unknown})  commonlanguageruntimelibrary!system.threading.threadhelper.threadstart() 

the error occurs because web role project depends on owin version=3.0.1.0, dll (which through nuget) depends on owin version=3.0.0.0. hence manifest mismatch.

so seems service runtime still loading assemblies in waiishost.exe check whether have roleentrypoint or not (i don't). before, put myassembly.dll.config binding redirects copied web.config e:\approot\bin, starts correctly.

can clarify looking for? provide answer in question (add redirects app.config), , provide link explanation in 1 of comments (http://blogs.msdn.com/b/avkashchauhan/archive/2011/01/24/dissection-of-a-windows-azure-sdk-1-3-based-asp-net-web-role-in-full-iis-mode-amp-hwc.aspx).

i can confirm seeing expected behavior , solution of adding binding redirects app.config correct.

the other potential solution change roleentrypoint code (ie. webrole.cs) not depend on assemblyb, version=1.0. whatever doing in roleentrypoint class, can done application_start runs within iis?


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -