Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access denied to Temp ASP.NET directory

Please review my UnauthorizedAccessException ASP.NET error.

Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\8909a2b1\8566823\Nop.Plugin.Feed.Froogle.dll' is denied.

The error has occured since I changed the website to be hosted through VS 2010 IIS from my machines IIS. My solution has previously worked in VS 2010 IIS as I went from VS IIS to Machine IIS back to VS ISS.

My Problem occurs when I copy dlls to the temp directory.

File.Copy(...

I've tested the various permissions on the directory and nothing helped. i also ran the aspnet_regiis -i command in the hope it would restore the desired permissions on the temp directory.

I dont have any problems if I delete the '../Temporary ASP.NET Directory', it only occurs when I try to replace existing files.

File.Copy("source", "c:\windows\microsoft.net\framework\v4\temporary asp.net files\...\###.dll", true);

Any help would be appreciated. Thanks,

like image 478
Christo Avatar asked Feb 24 '12 05:02

Christo


3 Answers

I have just spent hours troubleshooting this very same issue. In my case the dlls were from a solution that was checked in to SourceSafe and when copied into the temp folder they were marked ReadOnly. Once I removed the ReadOnly attribute the problem went away...

like image 56
Anonymous Avatar answered Oct 13 '22 19:10

Anonymous


You didn't mention which version of IIS you were running on. But you can use FileMon or ProcessMon to determine which user and resource is being denied.

like image 40
Nathan Rice Avatar answered Oct 13 '22 18:10

Nathan Rice


With impersonation involved, this can get tricky. Check your web.config for something like

    <identity impersonate="true"  ...

The user that is being impersonated also needs permission to the temp folders. I had to reboot, delete the temp folders, and reboot again until it finally took my changes and compiled without this error ...

like image 36
cdonner Avatar answered Oct 13 '22 19:10

cdonner