【问题标题】:Load System.Web fails but load System.Xml succeeds加载 System.Web 失败,但加载 System.Xml 成功
【发布时间】:2014-01-03 14:58:30
【问题描述】:

根据融合日志,问题是 System.Web 2.0 被重定向到不在 GAC 中的 System.Web 4.0,因此无法加载。我将它与 System.Xml 2.0 进行了比较,后者也被重定向到 System.Xml 4.0,但它确实在 GAC 中,因此加载成功。

我们的 app.config 正在强制从 2.0 程序集重定向到 4.0 程序集。

这是来自失败 System.Web 绑定的 sn-p:

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Windows\SysWOW64\pnbrksvc.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: 2.0.0.0 redirected to 4.0.0.0.
LOG: Post-policy reference: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.

这是 成功 System.Xml 绑定的 sn-p:

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Windows\SysWOW64\pnbrksvc.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: 2.0.0.0 redirected to 4.0.0.0.
LOG: Post-policy reference: System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: Binding succeeds. Returns assembly from C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll.
LOG: Assembly is loaded in default load context.

我假设 .NET 4 附带 System.Web。是否可以像以某种方式将 System.Web v4.0 重新安装到 GAC 中一样简单?

【问题讨论】:

    标签: c# .net .net-assembly fusion


    【解决方案1】:

    首先,在 machine.config 中包含它是非常糟糕的。可能会导致在以前的 .net 版本上运行的应用出现大量问题。

    关于丢失的 system.web.dll 也许在那台服务器上有人只安装了 .NET 4 客户端配置文件。客户端配置文件不包括 system.web...

    【讨论】:

    • 我们的 .NET 开发人员说是我们的 app.config 强制重定向,而不是我第一次报告的 machine.config。我以为是machine.config,因为融合日志在报告machine.config路径后就报告了版本重定向。
    • 我们已要求客户检查是否仅安装了 .NET 4 客户端配置文件。感谢您的提示。
    • 客户报告仅安装了 .NET Framework 4 客户端配置文件。卸载它并安装完整的框架解决了这个问题。谢谢!
    • 太棒了,欢迎 ;) 你现在付给我多少支持/咨询? ^^
    猜你喜欢
    • 2017-11-26
    • 1970-01-01
    • 2015-10-08
    • 1970-01-01
    • 1970-01-01
    • 2018-07-29
    • 1970-01-01
    • 2017-02-02
    • 1970-01-01
    相关资源
    最近更新 更多