1
votes

I am trying to deploy my ASP.Net MVC4 application to Azure but it is crashing during deployment. Apparently this is because something is requesting assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' . This all works perfectly locally and is a nightmare to debug on Azure as deployment takes 25-30 minutes for me.

I had thought I had configured CLR to not require MVC3 even if something wanted it by using:

        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
        </dependentAssembly>

If I look at the ObjectBrowser nothing seems to be requiring MVC3. What is the best way to figure out what is requesting it? I have various Nuget packages in the project. I guess one of them is requesting MVC3? Is there anyway to see a list of all dependencies etc?

I get:

CLR exception type: System.Reflection.ReflectionTypeLoadException "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information." Microsoft.WindowsAzure.ServiceRuntime Critical: 201 : ModLoad: 000007fc906a0000 000007fc907a9000
D:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll Role entrypoint could not be created: System.TypeLoadException: Unable to load the role entry point due to the following exceptions: -- System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.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) File name: 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeModule.GetTypes() at System.Reflection.Assembly.GetTypes() at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetRoleEntryPoint(Assembly entryPointAssembly) --- End of inner exception stack trace ---
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetRoleEntryPoint(Assembly entryPointAssembly) at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum) at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum) ModLoad: 000007fca2f00000 000007fca2f96000
D:\Windows\SYSTEM32\clbcatq.dll ntdll!ZwTerminateProcess+0xa: 000007fc`a2fa2eaa c3 ret

and

  Exception object: 00000000017e0070 Exception type:   System.TypeLoadException Message:          Unable to load the role

entry point due to the following exceptions: -- System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.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) File name: 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

InnerException: System.Reflection.ReflectionTypeLoadException, Use !PrintException 00000000017dcf08 to see more. StackTrace (generated): StackTraceString: HResult: 80131522

1
As an aside - you should really look at using Azure Websites with Git deployment via BitBucket or TFS deployment - I had the same nightmare deployment time - takes under a minute if you use Websites: windowsazure.com/en-us/develop/net/common-tasks/…levelnis
Yeah I was considering web sites rather than web roles. However the main issue is our comms is what is causing the delay. We are getting new high speed comms in next few weeks so should improve things. Certainly looking more at the idea of continual deployment etc and hopefully get there.GraemeMiller

1 Answers

1
votes

You can use Reflector to load the Nuget packages and look at their dependencies. Should be fairly easy to spot whether one is dependent upon MVC3. Your assembly binding looks fine though. Do you have multiple projects in your solution? Could one of those be taking a dependency on a Nuget package that depends on MVC3?

This post may help: How can I build a 'dependency tree diagram' from my .NET solution