Local IIS 7.0 - CS0016: Could not write to output file / Microsoft.Net > Framework > v4.0.30319 > Temporary ASP.NET Files

Solution to an annoying error message! You are getting 'Could not write to output file 'c:\Windows\Microsoft.NET\Framework\....' message? You are at the right place.
2011-03-05 10:18
Tugberk Ugurlu


This week I went nuts over my local IIS. I have never swore to a machine that much in my whole life. I am sure of that! The problem is not that big and probably not worth to be written on a blog post I am going to write it anyway because the solution was hard to find on the internet. Maybe this post will help you to fix the problem as I did and you will stop swearing to you machine as I did Smile

Let’s get to the point. I am no IIS guy! Seriously!  The so called Cassini (the tiny web server which pops up when you run a web application on Visual Studio) was so enough for me for over 2 years. But no more enough. I figured that IIS can not be ignored by me anymore. How can I get that point? That’s not the issue here. The issue is that I tried to run an ASP.NET MVC 3.0 application under my local IIS 7.0 and got a very annoying error. Which is;

Compiler Error Message: CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\62d43c41\27d749ca\App_Code.7lodcznm.dll' – 'Access denied.'

imageTemporary ASP.NET Files folder (c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files) was the the one with the problem here. First, I thought that the problem is related to security permissions on the folder and I was right.

I right clicked on the Temporary ASP.NET Files folder and go to the security tab. I noticed that there is user called IIS_IUSRS and that guy has the full control permission. But apparently that was not enough.

The Temporary ASP.NET Files  and C:\Windows\temp folders should have IIS_WPG and NETWORK SERVICE users with the full control permission. I have no idea why C:\Windows\temp folder needs that but I have no effort left to try to find that. Instead, I am writing a blog post about the problem. Maybe latter I will get to that and figure it out, too Smile

Once you applied those setting, restart your IIS and try to run your application again. The error should be gone by now.

I suffered a lot by trying to find the right method for the problem and I hope you didn’t have to go through hell over this.

Hope this helps Smile



Comments

daniel
by daniel on Thursday, Mar 24 2011 03:19:38 +02:00

thank you so much.

same with .net 2.0 iis 7.5

problem solved

Tugberk
by Tugberk on Thursday, Mar 24 2011 10:56:33 +02:00

@daniel

this problem took nearly half of my day. hope that you make it fixed quicker.

Tugberk
by Tugberk on Friday, May 27 2011 16:52:34 +03:00

@Caelen

I opened a thread about this on serverfault.com because I am not sure if this thing comes with some bad things. please see it as well;

http://serverfault.com/questions/274032/giving-full-control-for-network-service-user-on-asp-net-temp-folder

amal
by amal on Wednesday, Jun 01 2011 13:59:23 +03:00

You are great.

sephiroce
by sephiroce on Wednesday, Jul 20 2011 08:40:45 +03:00

really thank you!! it perfectly works for me!!!

Yaroslav
by Yaroslav on Wednesday, Jul 20 2011 12:29:18 +03:00

hmmm I tried set permissions manually and tried aspnet_regiis -ga command, but I still have this error...

Chris
by Chris on Saturday, Jan 14 2012 00:57:46 +02:00

Thanks a ton!

John
by John on Saturday, Jan 28 2012 16:19:10 +02:00

Thanks a lot man. 

suhail
by suhail on Monday, Feb 06 2012 08:49:57 +02:00

issue resolved. Great post!!! you saved my life...

Clint
by Clint on Sunday, Mar 18 2012 17:37:34 +02:00

Thanks a ton!

gbarret
by gbarret on Friday, Dec 21 2012 00:03:34 +02:00
after 2 dias waiting for a solution from our hosting company I decide to apply your solution and it works perfectly. Thanks a lot. In this case we have pp_wpg instead of iii_wpg
Eman
by Eman on Thursday, Jan 10 2013 16:15:08 +02:00

Thank you very much! this is very helpful!

 

Mikhail Sokolov
by Mikhail Sokolov on Friday, Feb 15 2013 12:26:12 +02:00

there is the another way to solve this problem: in IIS go to the application pools -> right click on your pool -> advanced settings - >change identity property to Custom account (write login and password). 

Sjors
by Sjors on Friday, Aug 23 2013 11:09:49 +03:00

You can do with less permissions. The following commands will set the settings needed on C:\Windows\Temp:

icacls %SystemRoot%\Temp /grant Users:(CI)(S,WD,AD,X)
icacls %SystemRoot%\Temp /grant "CREATOR OWNER":(OI)(CI)(IO)(F)

This worked for me.

Vimal
by Vimal on Friday, Oct 18 2013 11:16:00 +03:00

Thanks a lot!!!!

Eric
by Eric on Thursday, Oct 24 2013 18:37:21 +03:00

Lone star sized THANK YOU!!  Such a simple solution to a bewildering problem.

Krishna
by Krishna on Monday, Jan 20 2014 10:54:54 +00:00
I like this comment very much, it solved my problem, was facing for a long time to one of my client server. Thank you very much.
Paras Sitoula
by Paras Sitoula on Wednesday, Jan 29 2014 10:23:06 +00:00
Thanks man. that worked.
xyz
by xyz on Monday, Mar 31 2014 12:23:22 +00:00
Thank you saved my day..
Giacomo
by Giacomo on Tuesday, Jun 10 2014 08:44:12 +00:00
Thank you so much ... I sympathized with you since your first sentence. I'm a database guy, don't ask me way I'm doing this :D !!! Finally after 2 days of googling about this issue I landed here. Thank you!!!
Joe
by Joe on Thursday, Jun 26 2014 22:44:32 +00:00
Worked perfectly. Thank you!

New Comment