I have an asp.net application that uses an assembly NHibernate.dll, plus a bunch of other assemblies that this first one is dependent on. The application is getting an error periodically "Could not load file assembly... Access is denied". Once the error
occurs it will not go away. It doesn't always occur for the same file - sometimes it occurs for files that NHibernate.dll is depedent on. Does anyone have ideas how to fix this?
This app runs fine on my local. At first, it runs fine on a staging server too. But then, on the staging server, at some point I get an exception:
Could not load file or assembly 'NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=3a53e011584a29df' or one of its dependencies. Access is denied.
Based on where the error occurs in the call stack, this seems to be occuring when a new app domain is created.
Looking at the assembly load trace I see:
Assembly Load Trace: The following information can be helpful to determine why the assembly
'NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=3a53e011584a29df' could not be loaded.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dllRunning under executable
c:\windows\system32\inetsrv\w3wp.exe--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = MyDomain\MyUser
LOG: DisplayName = NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=3a53e011584a29df (Fully-specified)LOG:
Appbase = file:///C:/Inetpub/wwwroot/MyApp/LOG: Initial PrivatePath = C:\Inetpub\wwwroot\MyApp\binCalling
assembly : MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.===LOG: This bind starts
in default load context.LOG: Using application configuration file: C:\Inetpub\wwwroot\MyApp\web.configLOG:
Using host configuration file:
\\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.configLOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.LOG:
Post-policy reference: NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=3a53e011584a29dfLOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/MyApp/32ca0e24/8f29262d/NHibernate.DLL.LOG:
Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/MyApp/32ca0e24/8f29262d/NHibernate/NHibernate.DLL.LOG: Attempting download of new URL
file:///C:/Inetpub/wwwroot/MyApp/bin/NHibernate.DLL.ERR: Failed to complete setup of assembly (hr = 0x80070005).
Probing terminated.
One thing that puzzles me a lot is why the worker process is not trying to access the copy of the assembly in the "/Temporary ASP.NET Files" folder. Shouldn't it be using this "Shadow Copy" of the file? Or is it attempting this access, failing,
and then continuing with the other locations?
When I run the app locally, I see that the file in the bin directory is accessed (I see this using the ProcessMon tool), and not the copy in the /Temporary ASP.NET Files folder. Is this a problem? Could this be some issue with multiple worker processes
trying to access the same file?
When I tried running ProcessMon on the stagging server where the error occurs, once the error is occuring, using ProcessMon I don't see any attempt to access NHibernate.dll anywhere. This is puzzling too - I get this error above but ProcessMon doesn't see
the failed access (unless I have my filter setup wrong, which is quite possible...)
For an "Access is denied" message (for hresult E_ACCESSDENIED, 0x80070005):
Run tlist -m on the file to see if another process has the file locked and without share-read access. If not, check the ACLs for the file and its dependencies (especially if you're using impersonation).
I ran tlist -m previously and it shows that the worker process is accessing the file, as I mention in my post.
So my question is, is it normal that the web application is hitting the file in the \bin directory and not the file in the temporary internet folder (shadow copy folder)?
I am facing the same issue in production environment. My production environment is clustered (4 servers) and I am getting the same error message in all servers. Could you please help me on this?
Error Description :
An Error has occurred.If the problem persists, please contact support
quoting the following :
Could not load file or assembly XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.
Check your Framework... I had the same problem with Framework2.0 SP1. My components are developed in Framework2.0 then i updated machine with SP1, i got the same error for all the components.
Check your Framework in IIS.
Clear all the temp. files, sometimes two version of same DLL cause this kind of issues.
I am getting error message only for one particular assembly. All other assemblys in this application is working fine. Do you suggest delete file from temp folder would resolve this issue??
SecretSquirr...
0 Points
2 Posts
Could not load file or assembly, Access is denied.
Jul 22, 2007 02:05 AM|LINK
Hi All,
I have an asp.net application that uses an assembly NHibernate.dll, plus a bunch of other assemblies that this first one is dependent on. The application is getting an error periodically "Could not load file assembly... Access is denied". Once the error occurs it will not go away. It doesn't always occur for the same file - sometimes it occurs for files that NHibernate.dll is depedent on. Does anyone have ideas how to fix this?
This app runs fine on my local. At first, it runs fine on a staging server too. But then, on the staging server, at some point I get an exception:
Could not load file or assembly 'NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=3a53e011584a29df' or one of its dependencies. Access is denied.Based on where the error occurs in the call stack, this seems to be occuring when a new app domain is created.
Looking at the assembly load trace I see:
Assembly Load Trace: The following information can be helpful to determine why the assembly 'NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=3a53e011584a29df' could not be loaded.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dllRunning under executable c:\windows\system32\inetsrv\w3wp.exe--- A detailed error log follows. === Pre-bind state information ===LOG: User = MyDomain\MyUser
LOG: DisplayName = NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=3a53e011584a29df (Fully-specified)LOG: Appbase = file:///C:/Inetpub/wwwroot/MyApp/LOG: Initial PrivatePath = C:\Inetpub\wwwroot\MyApp\binCalling assembly : MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.===LOG: This bind starts in default load context.LOG: Using application configuration file: C:\Inetpub\wwwroot\MyApp\web.configLOG: Using host configuration file: \\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.configLOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.LOG: Post-policy reference: NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=3a53e011584a29dfLOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/MyApp/32ca0e24/8f29262d/NHibernate.DLL.LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/MyApp/32ca0e24/8f29262d/NHibernate/NHibernate.DLL.LOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/MyApp/bin/NHibernate.DLL.ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.One thing that puzzles me a lot is why the worker process is not trying to access the copy of the assembly in the "/Temporary ASP.NET Files" folder. Shouldn't it be using this "Shadow Copy" of the file? Or is it attempting this access, failing, and then continuing with the other locations?
When I run the app locally, I see that the file in the bin directory is accessed (I see this using the ProcessMon tool), and not the copy in the /Temporary ASP.NET Files folder. Is this a problem? Could this be some issue with multiple worker processes trying to access the same file?
When I tried running ProcessMon on the stagging server where the error occurs, once the error is occuring, using ProcessMon I don't see any attempt to access NHibernate.dll anywhere. This is puzzling too - I get this error above but ProcessMon doesn't see the failed access (unless I have my filter setup wrong, which is quite possible...)
Thanks!
JP
vcsjones
All-Star
34842 Points
4424 Posts
Moderator
MVP
Re: Could not load file or assembly, Access is denied.
Jul 22, 2007 05:09 AM|LINK
This blog article might prove to be resourceful on figuring out what is wrong, or fixing the issue: http://blogs.msdn.com/suzcook/archive/2003/05/29/57120.aspx
SecretSquirr...
0 Points
2 Posts
Re: Could not load file or assembly, Access is denied.
Jul 22, 2007 05:17 PM|LINK
Hi,
Yes I found that link previously. It states:
For an "Access is denied" message (for hresult E_ACCESSDENIED, 0x80070005):
Run tlist -m on the file to see if another process has the file locked and without share-read access. If not, check the ACLs for the file and its dependencies (especially if you're using impersonation).
I ran tlist -m previously and it shows that the worker process is accessing the file, as I mention in my post.
So my question is, is it normal that the web application is hitting the file in the \bin directory and not the file in the temporary internet folder (shadow copy folder)?
Thanks,
JP
anand.kesava...
Member
152 Points
39 Posts
Re: Could not load file or assembly, Access is denied.
Jun 27, 2008 02:02 PM|LINK
I am facing the same issue in production environment. My production environment is clustered (4 servers) and I am getting the same error message in all servers. Could you please help me on this?
Error Description :
An Error has occurred.If the problem persists, please contact support quoting the following :Could not load file or assembly XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.
PSP_152890
Participant
783 Points
154 Posts
Re: Could not load file or assembly, Access is denied.
Jun 27, 2008 08:10 PM|LINK
Check your Framework in IIS.
Clear all the temp. files, sometimes two version of same DLL cause this kind of issues.
Saravana Prakash P.
anand.kesava...
Member
152 Points
39 Posts
Re: Could not load file or assembly, Access is denied.
Jun 30, 2008 12:29 PM|LINK
I am getting error message only for one particular assembly. All other assemblys in this application is working fine. Do you suggest delete file from temp folder would resolve this issue??