W naszej usłudze Cloud Azure używamy Mvc, WebApi i Autofac.Jak rozwiązać System.Web.Http TypeLoadException w rozmieszczaniu roli Azure?
MVC i WebAPI chcą wersję System.Web.Http 5.2.3
Autofac.WebApi2 chce Wersja 5.2.0
Podczas wdrażania do Azure w wersji 5.2.3 rola internetowej nie aby uruchomić z powodu następującego błędu:
WaIISHost
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.Http, Version=5.2.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.Http, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
=== Pre-bind state information ===
LOG: DisplayName = System.Web.Http, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///E:/approot/bin
LOG: Initial PrivatePath = E:\approot\bin
Calling assembly : Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\base\x64\WaIISHost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from D:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Http, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///E:/approot/bin/System.Web.Http.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
tej pory próbowałam dodanie
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
Do MyAccountView.dll.config i umieścił go w folderze, ale błąd pozostaje ten sam (w tym wiersz o tym przy użyciu pliku WaIISHost.exe.config).
Próbowałem również zmodyfikować plik WaIISHost.exe.config podczas RDPing na wystąpienie, ale nie sądzę, że używa zmienionego pliku (jeśli przeryję plik konfiguracyjny, usuwając tag zamykający nie narzeka).
Człowieku, kocham cię. – Kadaj