views:

530

answers:

5

Every so often when I'm debugging, I get this message in nice brown text on an ASP.NET error page:

Access to the path "c:\windows\microsoft.net\framework\(version)\Temporary ASP.NET Files\(blah)" is denied.

I've never been able to figure out what causes it, what really fixes it, and why it happens.

Often times the path after the "Temporary ASP.NET Files" portion (the "(blah)") does not exist, so I'm not sure why it's looking there.

Sometimes an IISRESET fixes it, and sometimes it doesn't.

Sometimes an aspnet_regiis fixes it, and sometimes it doesn't.

Sometimes a reboot fixes it, and sometimes it doesn't.

For what it's worth I ran into this today with some .NET 1.1 code (yes, still maintaining some - hoping to upgrade it soon) and I'm not sure if I've ever seen it with .NET 2.0 and above.

Does anyone know what causes this and what should fix it? I assume it has multiple possible causes but I'm just curious if someone could shed some light on it.

+2  A: 

It was my understanding this can be caused by anti-virus running on the machine and intermittently locking the files.

Jeff Atwood
A: 

This could also happen when the IIS user doesn't have permissions into the \Temporary ASP.NET Files directory

Brendan Kowitz
+1  A: 

It could happen if the Windows indexing servicing is turned on for the temporary directory. See this article for details. Run File Monitor (available at sysinternals.com) and put a filter on the temporary directory. When you get the access error, see what application is causing the issue. It will most likely be the virus scan - exclude this directory from the scan and see if the problem is resolved.

Tai Squared
I had this problem all the time with ASP.NET 1.1. Disabling the indexing service on the temp folder worked for me.
Bullines
A: 

Add the user "everyone" to the permissions on the folder Temporary ASP.NET Files

A: 

By default, ASP.NET applications run under either the ASPNET account (IIS 5) or the NETWORK_SERVICE account (IIS 6/7). They also use the IUSR_MACHINENAME account if you have anonymous turned on for the site. Give these accounts full permissions to the temp directory you're having access problem with.

Bil