CS0016 & Temporary ASP.NET Files Errors...

I have been seeing many people with issues related to the “Temporary ASP.NET Files””

 

CS0016: Could not write to output file 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\application\…….' . The directory name is invalid.

 

You could also be getting an “Access Denied” message.

 

Here is a collection of fixes which I have found:

 

Temp Folder Fix:

http://support.microsoft.com/default.aspx?scid=kb;en-us;825791

 

Stop Indexing Server:

http://scrappydog.com/blogs/blog/archive/2004/12/19/408.aspx

 

Exclude the Temp folder from Index Server:

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=2041

http://support.microsoft.com/default.aspx?scid=kb;en-us;329065

 

Take Ownership of the Files:

http://weblogs.asp.net/bsimser/archive/2004/11/04/252512.aspx

You might also need to set the correct security permissions on the folder for your user (aspnet, networkservice or other)

http://www.chilkatsoft.com/faq/AccessDenied.html

 

When all else fails I have also attempted to simply delete Temporary ASP.NET Files\*.*, all sub folders and files.  You might need to IISReset in order to release the files.  Also consider reading the index server stuff above incase it has the files locked.  Perform the iisreset, and worst case scenario reboot and try again!

 

If you have found any other fix's please leave feedback and I will post them up.

 

 

13 Comments

  • Adam said

    I've tired everything but I still get an 'Access is denied' message. Are there any security setting that could be preventing this from loading?

  • James said

    Setting the correct security settings on the \windows\temp subdirectory fixed it for me, HOWEVER, it wasn't the NETWORK SERVICES account that needed to have full permissions. Keep in mind that if you create other APPLICATION POOLS and run your web applications under a different account (other than the default NETWORK SERVICES), you'll need to give that account full access to the temp directory. So, for example, many of you might have changed it from NETWORK SERVICES to IWAM_MACHINENAME. In that case, IWAM_MACHINENAME needs to have full access to the temp directory. I hope this helps out someone else. By the way, with was for .NET 2.0 IIS 6.0 as well as .NET 3.0 and .NET 3.5

  • Afrah said

    Server Error in '/HTCOMNET' Application. -------------------------------------------------------------------------------- The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [HttpException (0x80004005): The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.] System.Web.HttpRuntime.SetUpCodegenDirectory(CompilationSection compilationSection) +3591451 System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags) +222 [HttpException (0x80004005): The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3540923 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +69 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +275 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

  • Matteo Conta said

    Solved changing the permission on WINDOWS/TEMP folder, I've enable FULL access to the "NETWORK SERVICE" user account. If it doesn't work change the user on the application Pool and select "LocalSystem" or "LocalService". Restart the AppPool and retry.

  • Bill Swartz said

    This one can drive you crazy, but at the end of the day it's about security. Use FileMon (download from SysInternals) to monitor access to the server and highlight "Access Denied". This will immediately point you to the exact folder that is having the problem.

  • CiscoCylk said

    I am having terribly bad problems with the Temporary ASP.NET Files folder. Please see link to my posting http://forums.asp.net/t/1378090.aspx I am in dire need of help here. Please follow link in ASP.net forums and read and comment.

  • Fernando said

    Try creating a folder in your C drive - c:\Temp if you don't already have it and give it full NETWORK and ASP permissions. That worked for me. It's weird that my %systemroot%/temp folder has all the right permissions but IIS does not point to that! It pointed to the c:\temp folder which I deleted ages ago. Where else in IIS would it know that I once had a c:\temp folder? Strange.

  • Michael said

    Don't confuse "full permissions" with "modify" permissions. Generally you will not (should not) apply "full permission" to accounts unless you *really* want that account to be able to do things like modify permissions. Instead apply the minimum permissions required (read, read and write, modify, etc).

Comments have been disabled for this content.