无法加载文件或程序集'System.IO.Pipelines'



我最近将我的控制台应用程序项目从框架 4.5.2 升级到 4.6.1。在开发环境中一切正常,但是当我将完整的 bin 文件夹部署到生产环境时,出现以下错误。

未处理的异常:System.IO.FileLoadException:无法加载文件或程序集"System.IO.Pipelines,版本=4.6.26919.2,区域性=中性,公钥令牌=cc7b13ffcd2ddd51"或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(HRESULT的例外:0x80131040)

我已经在生产中设置了绑定重定向,如下所示:

  <dependentAssembly>
    <assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.6.26919.2" />
  </dependentAssembly>

该文件肯定存在于 bin 文件夹中,我的生产环境安装了框架 4.6.2。有什么想法吗?

使用 FUSLOGVW 的输出进行更新:

*** Assembly Binder Log Entry  (1/2/2019 @ 11:47:22 AM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from:  C:WindowsMicrosoft.NETFrameworkv4.0.30319clr.dll
Running under executable  {{REDACTED}}NotificationService.exe
--- A detailed error log follows. 
=== Pre-bind state information ===
LOG: DisplayName = System.IO.Pipelines, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
 (Fully-specified)
LOG: Appbase = file:///{{REDACTED}}/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NotificationService.exe
Calling assembly : Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: {{REDACTED}}NotificationService.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.config.
LOG: Post-policy reference: System.IO.Pipelines, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///{{REDACTED}}/System.IO.Pipelines.DLL.
LOG: Assembly download was successful. Attempting setup of file: {{REDACTED}}System.IO.Pipelines.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
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.

使用Microsoft的"程序集绑定日志查看器"(Fuslogvw.exe),它会告诉您正在处理哪些绑定请求,哪些请求失败。

https://learn.microsoft.com/en-us/dotnet/framework/tools/fuslogvw-exe-assembly-binding-log-viewer

如果生产环境中未安装 fuslogvw.exe,请检查以下内容:在未安装 Visual Studio 的计算机上使用 FUSLOGVW.EXE

最新更新