Search code examples
asp.netweb-servicesiismononpgsql

IIS 7 unable to load DLL (Access Denied)


I'm having this weird problem with IIS 7 on Windows 7, where it can't load a dll I'm using. However, it seems to only happen after a while; it works fine for some random amount of time until it starts throwing this message:

Could not load file or assembly 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Access is denied.

If I delete the dll and re-add it, it works fine for another length of time, and later stops working again. This is happening in both an asp.net webpage as well as a web service, however in a normal .net desktop program it works fine.

This only happens with Mono.Security, not with any other dll I'm using (I'm using Npgsql which is dependent on Mono.Security).

If anyone could offer some insight into this, it would be great.


Solution

  • Check file permissions on the DLL file / folder, to make sure your ASP.NET AppPool account can access the file.

    Make sure the file's permissions don't inherit from parent - something might be resetting these.