加载System.Web失败,但加载System.Xml成功

时间:2014-01-03 14:58:30

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

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

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

以下是失败 System.Web绑定的摘录:

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绑定的摘录:

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中一样简单?

1 个答案:

答案 0 :(得分:2)

首先,在machine.config中没有这个是非常糟糕的。在以前的.net版本上运行的应用程序可能会导致大量问题。

关于缺少的system.web.dll可能在那台服务器上有人只安装了.NET 4 Client Profile。客户端配置文件不包括system.web ...