开发者

C# - Could not load file or assembly ZedGraph

开发者 https://www.devze.com 2023-03-02 13:33 出处:网络
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

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:\CycleReade开发者_运维技巧r\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:


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消