C# - 无法加载文件或程序集 ZedGraph

发布于 2024-11-04 19:27:08 字数 1387 浏览 0 评论 0原文

我在使用 Visual Studio 2008 用 C# 编写的 Windows 窗体应用程序上遇到以下错误。奇怪的是,它在我的家庭 PC 上运行没有任何问题,尽管在大学计算机上测试时我收到错误。

System.IO.FileLoadException was unhandled
Message="Could not load file or assembly 'ZedGraph, Version=5.0.9.41461, Culture=neutral, PublicKeyToken=02a83cbd123fcd60' or one of its dependencies. Access is denied."
  Source="CycleReader"
  FileName="ZedGraph, Version=5.0.9.41461, Culture=neutral, PublicKeyToken=02a83cbd123fcd60"
  FusionLog=""
  StackTrace:
       at CycleReader.CycleChart..ctor()
       at CycleReader.CycleReader..ctor() in F:\CycleReader\CycleReader\CycleReader.cs:line 57
       at CycleReader.Program.Main() in F:\CycleReader\CycleReader\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.UnauthorizedAccessException
       Message="Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
       InnerException:

I am getting the following error on a Windows Forms application that I have written in C# using Visual Studio 2008. The strange thing is that it works on my home PC without any problems, although when testing on the university computers I get the error.

System.IO.FileLoadException was unhandled
Message="Could not load file or assembly 'ZedGraph, Version=5.0.9.41461, Culture=neutral, PublicKeyToken=02a83cbd123fcd60' or one of its dependencies. Access is denied."
  Source="CycleReader"
  FileName="ZedGraph, Version=5.0.9.41461, Culture=neutral, PublicKeyToken=02a83cbd123fcd60"
  FusionLog=""
  StackTrace:
       at CycleReader.CycleChart..ctor()
       at CycleReader.CycleReader..ctor() in F:\CycleReader\CycleReader\CycleReader.cs:line 57
       at CycleReader.Program.Main() in F:\CycleReader\CycleReader\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.UnauthorizedAccessException
       Message="Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
       InnerException:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蹲在坟头点根烟 2024-11-11 19:27:08

这可能很简单,例如大学计算机上未安装 .NET 运行时,或者某些其他依赖项(例如与您家里的编译器版本相同的 Microsoft Visual C++ 2008 Runtime),甚至更多复杂的 .NET 不信任位于网络驱动器上的应用程序,无需额外的权限和帮助。

This could be as simple as the .NET runtime not being installed on the university computers, or some other dependency such as the Microsoft Visual C++ 2008 Runtime for the same compiler version as yours at home, to something more complex as .NET not trusting applications located on network drives without additional permissions and assistance.

鱼忆七猫命九 2024-11-11 19:27:08

由于异常包含文本访问被拒绝。,您可以相信这就是问题所在。

确保引用的程序集位于运行应用程序的帐户有权读取的位置。

Since the exception includes the text Access is denied., you can trust that's the issue.

Make sure the referenced assemblies are in a location that the account that the application is running under has permissions to read from.

零時差 2024-11-11 19:27:08

我知道这是 Visual Studio 2010 中的一个问题,但我不确定 2008 年的情况...但是如果您从浏览器下载了代码,那么 Windows 将默认阻止该文件。您可以尝试转到资源管理器中 DLL 的属性,然后单击“取消阻止”(如果有)来取消阻止该文件。

尝试获取 DLL 时,您似乎遇到了“拒绝访问”错误。要么是某个地方受到限制,要么是您的病毒扫描程序保护过度。

I know this is an issue in Visual Studio 2010, but I'm not sure about 2008... but if you downloaded the code from a browser, then Windows will block the file by default. You can try going to the properties of the DLL in Explorer and clicking "Unblock" if it is there to unblock the file.

It looks like you are getting Access Denied error when trying to get the DLL. Either it is somewhere restricted or you have an over-protective virus scanner.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文