开发者

Access denied when loading dependency .dll .NET

开发者 https://www.devze.com 2022-12-10 17:30 出处:网络
We have a .NET WinForms application that has several .NET dll\'s it depends on, running on an XP machine, that is connected to a network in a large domain.

We have a .NET WinForms application that has several .NET dll's it depends on, running on an XP machine, that is connected to a network in a large domain.

We deployed this application on a cust开发者_StackOverflow中文版omers machine while logged in as an admin and all worked fine.

We then logged into a lower privalaged account, and low and behold the application failed to start, but that was expected.

So, we got their IT department to make the folder Read/Write access (as we use folders in there for holding temp files) and they allowed the .exe to be executable by that user.

Now starting the executable, the application runs (yay) but then we got it to perform an action that required code in one of it dependant (managed) dll's...

An Exeception is thrown, stating "The assembly "xxxx.dll" failed to load (access is denied)" I am assured by their IT department that the dll's have the same file permissions as the main executable (and by quick look at what the lower privilege user can see of security settings, it did appear that way) and they were not set as "blocked" as XP sometimes does.

So the question is more of a fish for possible ideas that may be causing this...

EDIT: Turns out it was file permissions that were the problem and that the IT department in question hadn't followed through checking that permissions had been applied to all child objects. As I can't accept all 4 of your answers for such good ideas I have given you all an up vote.


The user may have access to the DLL listed in the error message but do they have access to all of the DLLs that that DLL needs? Check out something like Dependency Walker to find any DLLs that might be required.


Several possible problems, some detailed here: http://msdn.microsoft.com/en-us/library/ab4eace3.aspx

You may be asking to load an assembly that makes security demands that are larger than your main application. (Requesting permissions: http://msdn.microsoft.com/en-us/library/yd267cce.aspx )

If you are running full trust this is unlikely, but if the DLL you are loading is on the network make sure you have that location trusted by .NET: (trusting a share: http://blogs.msdn.com/shawnfa/archive/2004/12/30/344554.aspx )


Does the DLL access the registry or some other system folder that the lower privilege user isn't allowed to access? What is it trying to do when the error occurs?

You could also check whether the domain has some kind of group policy that's interfering with what the DLL is trying to do.


.NET doesn't trust assemblies from non-local drives by default.

See http://msdn.microsoft.com/en-us/library/zdc263t0.aspx for instructions to allow specific network locations to be trusted.

0

精彩评论

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

关注公众号