Friday, June 4, 2010

Access Denied when Running Site Locally

"Could not load file or assembly 'xxxxxx' or one of its dependencies.  Access is denied."

If you get this exception when running an ASP.Net site through the Visual Studio web server, make sure that McAfee isn't causing the problem.  Here's what I had to do to turn it off:

  1. Open the "VirusScan Console"
  2. Go to properties on "Access Protection"
  3. Click on "Common Maximum Protection"
  4. Make sure "Prevent creation of new executable files in Windows folder" is set to NOT block.
  5. Click "OK"
  6. Now restart the Visual Studio web server and it should work!

I’ve also had this problem when the Windows Search Service is trying to index the DLL’s in my “bin” folder every time I compiled.  You could try using the “Process Monitor” tool to see if there’s another program accessing your DLL causing the locking problem.