9

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

Cheran Shunmugavel
  • 8,319
  • 1
  • 33
  • 40
Grasshopper
  • 4,717
  • 9
  • 36
  • 62

5 Answers5

24

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" />
Community
  • 1
  • 1
Chris Benard
  • 3,167
  • 2
  • 29
  • 35
  • 1
    We are hosting the site through HostMySite and they keep telling me that they will not allow write access to that directory. I have been arguing with them on this issue amongst others for days. Do you recommend that I try to find some MSFT documentation that clearly states your information above to prove that they are not configured correctly? I have had nothing but problems with this host since they began re-platforming 6-8 months ago. Naturally, the application works fine in our development environment. – Grasshopper Apr 03 '12 at 13:30
  • The support person you're talking to probably doesn't understand. That MSDN article explains it. If what they're saying is true, almost everyone's site would be broken. If they **do** give you a directory you can write to, you can set that in the `web.config` [to use that directory](http://msdn.microsoft.com/en-us/library/system.web.configuration.compilationsection.tempdirectory.aspx). – Chris Benard Apr 03 '12 at 13:34
  • [Here's](http://msdn.microsoft.com/en-us/library/s10awwz0.aspx) a better link to the `tempDirectory` setting. Basically you'll do `` inside your `` element in `web.config`. – Chris Benard Apr 03 '12 at 13:36
  • Thanks, I found it in your article shortly after I posted the comment. That worked perfectly. Thanks for your help. – Grasshopper Apr 03 '12 at 14:01
  • 1
    Have just noticed this happening in Windows 8 "Release Preview" so I guess some default setting has changed? With exact same installer. I don't get this error in any of: Windows 7, or Server 2008 R2, or XP SP3 – Daniel Earwicker Jun 06 '12 at 09:32
8

Add your application pool's identity to the server's IIS_IUSRS group.

hawkeyecoder
  • 571
  • 4
  • 10
  • Brilliant! I had added Full control to Temporary ASP.NET Files for my apppool user. But after adding the apppool user to the IIS_IUSERS group I could remove the Full control permission and everything worked perfectly. Many thanks! – rob Jan 17 '14 at 10:01
1

I had to set the Application Pool identity to NETWORKSERVICE And then add the user connecting to my website (the user you 'connect as' in IIS settings under Basic Settings for your website) to the IIS_IUSRS group

Adam
  • 6,041
  • 36
  • 120
  • 208
1

I had this error when I set the Physical Path Credentials (in Advanced Settings) to my application pool's account.

In my case the fix was to reset Physical Path Credentials to "Application user", and to fix my original error using this answer, i.e. to reset anonymous authentication to Application Pool identity, which for this specific site was IUSR, a user that did not have access to the application path (since we're using a specific user for the app pool identity).

Community
  • 1
  • 1
Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
0

Also can reinstall asp.net, find the steps from below :

cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
aspnet_iis -i
bing duan
  • 3
  • 2