13

试图理解这个程序集绑定失败 - 下面日志中的“后策略参考”是什么意思?

LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\approot\WorkerRole.dll.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: 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:\approot\Microsoft.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,所以我试图弄清楚发生了什么。

4

1 回答 1

6

我的理解是,“后策略引用”是发布者策略之后的程序集引用,并且在一般程序集重定向发生后。例如,请参阅https://indexoutofrange.com/Could_not_load_file_or_assembly_or_one_of_its_dependencies/以获取一些示例。

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

...
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.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。再次查看前面的链接以获取示例。

于 2017-02-28T23:39:38.210 回答