System.IO.FileLoadException:无法加载文件或程序集

问题描述:

尝试执行我的Web应用程序时,它会引发以下错误。
它说Matrix.Data.dll无法加载。我试图重新组装并重新引用它。但没用。
此外,它显示一个警告'装配绑定日志已关闭'
以及与装配绑定失败日志记录相关的性能损失是什么......?System.IO.FileLoadException:无法加载文件或程序集

错误详细:

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

File name: 'Matrix.Data, Version=5.0.3.16, Culture=neutral, 
PublicKeyToken=ed19106b2f44b5a8' 
at Matrix.Administration._Administration.DoRequest(Boolean& plReplacePlaceholders) 
at Matrix.AppServerHTTPHandler.doRequestDefault() 
in D:\FX\AppServer\Appserver.vb:line 443 
at AppServer.AppServerHTTPHandler.doRequest(Kernel pKernel) 
in D:\FX\AppServer\Appserver.vb:line 373 
at AppServer.AppServerHTTPHandler.processRequest(HttpContext context) 
in D:\FX\AppServer\Appserver.vb:line 107 

WRN: Assembly binding logging is turned OFF. 
To enable assembly bind failure logging, set the registry value 
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
Note: There is some performance penalty associated 
with assembly bind failure logging. 
To turn this feature off, remove the registry value 
[HKLM\Software\Microsoft\Fusion!EnableLog]. 
+1

将[Dependency Walker](http://www.dependencywalker.com/)下载到已部署的位置,打开该程序集并确保它不缺少依赖关系。如果它不是,那么加载它的一些依赖关系并查看它们缺少的内容。 – 2013-04-11 16:59:24

+1

它可能是你在这里有不匹配的.Net版本? – wonko79 2013-04-11 17:02:03

+1

@ wonko79:我检查了引用程序集的.Net版本,它们在V3.5中相同,并使用VS2008创建。有一件事指出,他们是32位程序集试图在64位操作系统的IIS中执行....是一个问题...? – Sunil 2013-04-11 18:13:51

你Accessibility.dll是最有可能损坏。即使以管理员身份,您也无法删除该文件。

您必须进入安全设置并将所有者从TrustedInstaller更改为其他用户,并为您自己授予文件权限。完成后,从工作的计算机上获取Accessibility.dll并替换损坏的版本。

最好我猜测,微软的一个安装程序破坏了DLL,因为没有用户有权编辑/删除/替换TrustedInstaller拥有的文件。

+1

谢谢@Ashok。我会检查。 – Sunil 2013-04-11 18:02:25