C# VS2005:DLL 可能损坏
当我运行引用特定 DLL 的 exe 时,出现以下错误。
无法加载文件或程序集“XYZ.ABC.DEF,版本= 1.0.3801.24033,文化=中性,PublicKeyToken = null”或其依赖项之一。访问被拒绝。
上述错误是否是由于 XYZ.ABC.DEF.DLL 损坏所致? DLL 可能出现什么问题导致此错误。我们只是尝试在这个 DLL 上使用 Reflector 工具,但无法反映它。
请帮忙。
I am getting following error when I run an exe referencing a particular DLL.
Could not load file or assembly 'XYZ.ABC.DEF, Version=1.0.3801.24033, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.
Could the above error be due to XYZ.ABC.DEF.DLL being corrupt? What could be wrong with the DLL to cause this error. We just tried to use Reflector tool on this DLL and we could not reflect it.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发生这种情况的最可能原因是程序集或其依赖项之一具有阻止当前进程访问该文件的权限。如果它已损坏,您可能会看到
BadImageFormatException
或类似的错误消息。访问被拒绝错误是链中某处权限问题的结果。下一步是简单地尝试使用相同的凭据打开 DLL,看看会发生什么。或者使用 fuslogvw 跟踪加载失败并准确找出哪个 DLL 出现问题。
The most likely cause for this happening is that either the assembly or one of it's dependencies has permissions that prevent the current process from accessing the file. If it were corrupted you would likely see a
BadImageFormatException
or the like error message. The access denied error is the result of a permission issue somewhere in the chain.The next step is to simply try and open the DLL using the same credentials and see what occurs. Or use fuslogvw to track the load failure and figure out exactly which DLL is having the problem.
“访问被拒绝”通常意味着您没有读取文件的权限。如果 dll 位于受保护的系统位置,则可能会发生这种情况(例如,即使您是管理员,也可能对不同用户帐户文件夹中的文件“访问被拒绝”)。
请确保您具有管理员权限,并尝试复制 dll 及其对您拥有完全访问权限的文件夹的依赖项。
"Access is denied" usually means that you don't have permissions to read a file. This could happen if the dll is in a protected system location (even if you are an administrator you can get "access denied" on files within a different user's account folders, for example)
Make sure you have admin privileges, and try copying the dll and its dependencies to a folder that you have full access permissions for.