绑定重定向的框架配置在哪里?

时间:2018-10-09 19:27:20

标签: .net dll .net-standard assembly-binding-redirect

我的ASP.NET MVC网络后端消耗了System.Security.Cryptography.Algorithms.dll。在生成时,可以在以下位置找到dll:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\Facades

在运行时,dll被解析为:

C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Security.Cryptography.Algorithms\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.Cryptography.Algorithms.dll

这是fuslogvw显示的内容:

...
LOG: Assembly download was successful. Attempting setup of file: path\to\bin\System.Security.Cryptography.Algorithms.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.Security.Cryptography.Algorithms, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy.
LOG: Using application configuration file: path\to\web.config
LOG: Using host configuration file: C:\Users\xxx\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Version redirect found in framework config: 4.2.2.0 redirected to 4.0.0.0.
LOG: Post-policy reference: System.Security.Cryptography.Algorithms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Security.Cryptography.Algorithms\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.Cryptography.Algorithms.dll.
LOG: Assembly is loaded in default load context.

我对排队特别感兴趣 LOG: Version redirect found in framework config: 4.2.2.0 redirected to 4.0.0.0.

问题:

上面提到的那个框架配置在哪里?日志中提到的三个文件(web.configmachine.configaspnet.config都没有包含System.Security.Cryptography.Algorithms.dll的绑定重定向指令,那么它在哪里?

1 个答案:

答案 0 :(得分:4)

您看到的行来自运行时内部的统一表。

运行时具有一些程序集的特殊知识,并且对于这些程序集,将应用特殊的绑定重定向 ,如果未指定用户指定的绑定重定向(在您提到的位置)。