Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is My ASP Web Application Attempting to Write to C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files?

Tags:

c#

asp.net

iis

I am encountering issues while deploying an ASP web application to HostMySite. The application has previously been deployed to their servers that are on different platforms without issues. However, for the current domain and server I continue to get the server error below.

Server Error in '/PropertyManagement' Application. The current identity (ADSAFESECUREWEB\C116018-fhmonlinea) does not have write access to 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\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 (ADSAFESECUREWEB\C116018-fhmonlinea) does not have write access to 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\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. I know that the code is not explicitly attempting to write to the .NET temporary directory but, I was wondering if the application is somehow using that directory during run-time. The host keeps telling me that I have to configure my application to not use the temporary directory since they will not provide read/write access to it. Can someone please tell me why my application might be attempting to use this directory and what I can do to configure it to use a different directory that I have access to. I am new to ASP development and need help. Thanks!

Stack Trace:

[HttpException (0x80004005): The current identity (ADSAFESECUREWEB\C116018-fhmonlinea) does not have write access to 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files'.] System.Web.HttpRuntime.SetUpCodegenDirectory(CompilationSection compilationSection) +11650831 System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +323

[HttpException (0x80004005): The current identity (ADSAFESECUREWEB\C116018-fhmonlinea) does not have write access to 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files'.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11612256 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4842149

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

like image 533
Grasshopper Avatar asked Apr 03 '12 13:04

Grasshopper


People also ask

Is it safe to delete temporary asp net files?

The temporary files generated by Visual Studio after creating and running an ASP.NET application reside in: %SYSTEMROOT%\Microsoft.NET\Framework[64]\<vernum>\Temporary ASP.NET Files folder. The folders and files under this folder can be removed with no harm to your development computer.

Which file is known as ASP NET application file?

asax is an optional file which is used to handling higher level application events such as Application_Start, Application_End, Session_Start, Session_End etc. It is also popularly known as ASP.NET Application File. This file resides in the root directory of an ASP. NET-based application.


1 Answers

The CLR copies all your assemblies to that directory and compiles your .aspx/.asmx/etc files and puts the compiled version in Temporary ASP.NET Files.

This must be writable so that your site can be compiled at runtime.

Edit: Here is an MSDN article explaining it.

As discussed in the comments, if the provider refuses to let you write to that directory, you can override it by putting the following in your web.config, 'system.web' section:

<compilation tempDirectory="c:\path\to\directory\you\can\write" />
like image 55
Chris Benard Avatar answered Nov 15 '22 19:11

Chris Benard