Bob*_*nes 8 .net c# system.xml .net-assembly windows-10
我有一个.NET 4.5应用程序,在大多数环境中都可以正常运行和运行; 但是,应用程序的一个区域会在某些客户端计算机上引发运行时程序集引用错误:
Could not load file or assembly 'System.Xml.Linq, Version 4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The file cannot be accessed by the system. (Exception from HRESULT: 0x80070780)
Run Code Online (Sandbox Code Playgroud)
我运行了融合日志,有趣的是,这个程序集似乎加载了两次,一次加载版本4.0.0.0,然后加载版本3.5.0.0加载Newtonsoft.Json版本6.0.8.第一个加载工作,第二个是绑定错误的来源.
以下是成功4.0.0.0绑定的Fusion日志:
<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>
*** Assembly Binder Log Entry (1/16/2017 @ 12:40:06 PM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
(Fully-specified)
LOG: Appbase = file:///C:/Users/<user>/AppData/Local/Apps/MyApplicationPath/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplication.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll.
LOG: Assembly is loaded in default load context.
</pre></html>
Run Code Online (Sandbox Code Playgroud)
这是不成功的3.5.0.0绑定:
<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>
*** Assembly Binder Log Entry (1/16/2017 @ 12:41:12 PM) ***
The operation failed.
Bind result: hr = 0x80070780. The file cannot be accessed by the system.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Users/<user>/AppData/Local/Apps/MyApplicationPath/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplication.exe
Calling assembly : Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Version redirect found in framework config: 3.5.0.0 redirected to 4.0.0.0.
LOG: Post-policy reference: System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll.
LOG: Assembly is loaded in default load context.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070780).
</pre></html>
Run Code Online (Sandbox Code Playgroud)
对我来说真正没有意义的是,它是从同一个位置装载组件,而第二次它不能正常工作.我认为这可能是由于GAC程序集上的某些类型的锁定,但在检查工作环境中的Fusion日志之后,日志文件是相同的,只是没有最终的错误行,所以不是这样.
同样有趣的是,这个问题似乎只发生在Windows 10计算机上,而不是所有Windows 10计算机上.它似乎也不仅限于升级或新的Win10安装; 它发生在两者上.
我已经尝试了很多方法来解决这个问题,包括:
我似乎用完了选项,不幸的是,我无法获得比"不可恢复的错误"更明确的错误,所以我不确定在哪里看.任何帮助是极大的赞赏!