什么是程序集绑定日志中的Post-Policy引用



试图理解这个程序集绑定失败-下面日志中的"Post-policy reference"是什么意思?

LOG: This bind starts in default load context.
LOG: Using application configuration file: E:approotWorkerRole.dll.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from D:WindowsMicrosoft.NETFramework64v4.0.30319configmachine.config.
LOG: Post-policy reference: Microsoft.WindowsAzure.Diagnostics, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///E:/approot/Microsoft.WindowsAzure.Diagnostics.DLL.
LOG: Assembly download was successful. Attempting setup of file: E:approotMicrosoft.WindowsAzure.Diagnostics.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.WindowsAzure.Diagnostics, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

没有我可以看到在我的代码引用DLL,所以试图弄清楚发生了什么。

我的理解是,"策略后引用"是在发布者策略之后的程序集引用,在一般情况下,程序集重定向已经发生。参见https://indexoutofrange.com/Could_not_load_file_or_assembly_or_one_of_its_dependencies/查看一些示例。

如果指定了重定向,融合日志将如下所示:

...
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.config.
LOG: Redirect found in application configuration file: 3.2.1.0 redirected to 4.0.0.0.
LOG: Post-policy reference: NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c
...

关于为什么加载这个dll,那么你的日志片段缺少相关的行。

上面一行
LOG: This bind starts in default load context.

应该有类似

的内容
Calling assembly : XYZ.

引用了对Microsoft.WindowsAzure.Diagnostics有引用的程序集。同样参见前面的示例链接。

最新更新