Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.UnauthorizedAccessException: Access to the path is denied VS2013

I am getting following error while running my asp.net web application through VS2013.

Error: System.UnauthorizedAccessException: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\0c9c5fe5\51acd19b' is denied.

FYI, I was getting some error earlier and to resolve that error I deleted all files inside "Temporary ASP.NET Files\root\" folder which caused above error.

I tried following: - Restarted VS2013 using admin privilege! - Added full permissions IIS_IUSRS on my web app folder - C:\Samples\ASP.NET\WebApp1 - Added full permissions IIS_IUSRS on my aspnet temp folder - C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root

Please help!

enter image description here

like image 640
Chirag Avatar asked Jan 02 '15 17:01

Chirag


2 Answers

For me the problem was caused by the Exception Settings. Debug -> Windows -> Exception Settings In the window that is shown uncheck -> Common Language Runtime Exceptions

I turn it on from time to time to break on all errors including handled ones and had left it on. Then when debugging my ASP.Net MVC app it then halts on the access denied errors on start. My guess is it tries to write temp files to Location A, gets an access denied error, then uses Location B.

like image 197
John Petrak Avatar answered Oct 21 '22 07:10

John Petrak


Are any of the dlls in your solution marked as readonly?

Have they been checked out from source control?

Did you reboot after changing the permissions?

What is the identity of the Application Pool User, do they have access to the temp folder?

Is your web app impersonating another user at all?

Is your App doing anything on bootup, that could cause this?

Use SysInternals FileMon to see if another process is using it.

like image 26
Ralph Willgoss Avatar answered Oct 21 '22 06:10

Ralph Willgoss