Umleitung der Baugruppenbindung funktioniert nicht

Ich versuche, eine Test-Webanwendung auf Azure bereitzustellen, aber wenn ich den Azure-Emulator auf meinem lokalen Computer ausführe, wird dieser Fehler von der an meine WebRole angehängten Azure-Emulatorkonsole angezeigt:

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'

=== Pre-bind state information ===
LOG: User = COLLAB\mirko.lugano
LOG: DisplayName = System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Code/Application/<MyWebProject>.Azure/csx/Debug/roles/<MyWebProject>/approot/bin
LOG: Initial PrivatePath = C:\Code\Application\<MyWebProject>.Azure\csx\Debug\roles\<MyWebProject>\approot\bin
Calling assembly : ActionMailer.Net.Mvc, Version=0.7.4.0, Culture=neutral, PublicKeyToken=e62db3114c02a1c2.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Code\Application\<MyWebProject>.Azure\csx\Debug\roles\<MyWebProject>\base\x64\WaIISHost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Code/Application/<MyWebProject>.Azure/csx/Debug/roles/<MyWebProject>/approot/bin/System.Web.Mvc.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

---> 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)
[fabric] Role state Unknown

Alles hat einwandfrei funktioniert, solange MVC3 auf meinem lokalen Computer installiert war (die MVC3-Assembly befand sich in GAC). Da ich MVC3 entfernt habe (in Azure ist kein MVC installiert), wird dieser Fehler angezeigt. In meiner Web-App ist MVC4 regelmäßig enthalten, und das funktioniert einwandfrei. Ich hatte damals über die Umleitung von Assembly-Bindungen nachgedacht und festgestellt, dass ich in meiner Datei web.config bereits Folgendes habe:

  <runtime>    
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">      
    ...
    <dependentAssembly>        
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
    </dependentAssembly>
    ...
  </assemblyBinding>
</runtime>

das sollte schon stimmen, laut der dokumentation habe ich im internet rumgelesen. Ich habe auch versucht das einzustellenSpecificVersion Eigentum von mirSystem.Web.Mvc.dll (Version 4.0.0.0) bisfalsch aber ohne Erfolg. Vermisse ich etwas? Sollte die anrufende Versammlung nichtActionMailer.Net.Mvc automatisch auf die richtige Version der MVC-Assembly umgeleitet werden? Alle Ideen werden sehr geschätzt. Vielen Dank.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage