我有一个“ Dell Hell”问题。在解决方案中的各个项目中,我安装了System.Net.Http 4.3.3软件包,该软件包还安装了System.IO 4.3.0和System.Runtime 4.3.0软件包作为依赖项,但应用程序未加载此程序集的正确版本。在Web.config文件中,我具有以下绑定重定向:
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
但是在运行时,应用程序会加载所有程序集的4.0.0.0版。 我试图在程序集加载日志中找到问题,但在其中未找到任何有用的信息。例如,System.Net.Http程序集日志为:
*** Assembly Binder Log Entry (10/01/2019 @ 3:03:33 p.m.) ***
The operation was successful.
Bind result: hr = 0x0. La operación se completó correctamente.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Program Files\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///%ProjectPath%
LOG: Initial PrivatePath = %ProjectPath%\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\vs\8b39e507
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\vs\8b39e507
LOG: AppName = 73c96623
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: %ProjectPath%\web.config
LOG: Using host configuration file: %UserFolderPath%\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Binding succeeds. Returns assembly from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\vs\8b39e507\73c96623\assembly\dl3\3c60a4ed\001138c2_8026d301\System.Net.Http.dll.
LOG: Assembly is loaded in default load context.
我试图更新所有nuget软件包,以找到一些需要4.0.0.0版本的旧依赖性,但是应用程序始终加载错误版本。
无法卸载和重新安装nuget软件包,主项目中最多有90个软件包引用。
我以为问题是由项目中的.Net3.5参考引起的,但是删除此问题我仍然遇到相同的问题。
谢谢