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

标签 .net

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

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.IO.Pipelines, Version=4.6.26919.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我在生产中设置了绑定(bind)重定向,如下所示:

  <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文件夹中,并且我的生产环境安装了framework 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:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.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:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.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.

最佳答案

使用微软的“程序集绑定(bind)日志查看器”(Fuslogvw.exe),它会告诉您哪些绑定(bind)请求正在处理以及哪些失败。

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

如果生产环境中未安装fuslogvw.exe,请检查以下内容: using FUSLOGVW.EXE on a machine with no Visual Studio installed

关于.net - 无法加载文件或程序集 'System.IO.Pipelines',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54010475/

相关文章:

c# - 锁语句有多贵?

c# - 添加项目引用会阻止 Windows 服务启动 - 错误 1053

c# - NHibernate:在提交事务之前调用 Session.Flush() 是否有效?

c# - WPF/.NET 数据访问模型 - 资源推荐

c# - 在不安装 Python 的情况下在 .NET 环境中运行 Python 代码

.net - 什么对 REST API 更好? WCF Web API(预览版 4)或 OpenRasta 或其他什么?

c# - 从类型名称转换为类型作为字符串

.net - 将数据表的日期类型列转换为输出上的短日期 - VB.Net

c# - 用c#替换word文档中的占位符

c# - 在进行一些密集计算之前等待多个快速属性更改事件 (C#)