I have found plenty of information out there about this error: \'ERROR: Could not load file or assembly \'*.dll\' or one of its dependencies. Access is denied.’ But i haven
Had the same issue, fixed with setting the parameter "Enable 32-bit applications" to "true" (in advanced settings of iis application pool).
I believe I wasted like 1 day on researching it and this what I have come out with.
You need to add the Impersonating user to the Debug folder of your Solution as the Framework will try to access the DLL from this location and place it in Temporary Asp.Net Folder.
So basically follow these 2 steps
Give permission to Temporary Asp.Net Folder under C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
and make sure the user you are adding here is the same you are using while Impersonating.
Add the Impersonating user to the Debug folder of your Solution YourSolutionPath .. \bin\Debug
This should work
In my case, I had copied a service from one server to another without performing a proper deployment from Visual Studio. Long story.
Anyway, I had setup all of the appropriate NTFS permissions and whatnot, but it still couldn't load the main DLL for the service.
I fixed it by renaming the corresponding service.pdb file to something else.
For example here's my bin folder:
\bin\
service.dll
service.dll.config
service.pdb
I renamed service.pdb to zzservice.pdb, and then the service.dll loaded fine.
In my case, I was using simple impersonation and the impersonation user had trouble accessing one of the project assemblies. My solution:
Modify the security properties of the assembly file.
a) Add the user account you're using for impersonation to the Group and user names.
b) Give that user account full access to the assembly file.
I am setting-up environment on new server. My web.config got identity node like below.When I faced with "Could not load file or assembly or one of its dependencies. Access is denied. The issue is random, but after it happens once, it continues"
Added ccs\HJKWeb as users list of my new server.
<authentication mode="Windows" />
<identity impersonate="true" password="******" userName="ccs\HJKWeb" />
If you get the DLL could not be found instead of access denied, make sure you have the appropriate VC++ Redistributable installed.