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


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

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


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

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


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;


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

You are great.

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

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

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...

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

Thanks a ton!

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

Thanks a lot man. 

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

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

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

Thanks a ton!

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
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). 

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.

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

Thanks a lot!!!!

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.

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.
by xyz on Monday, Mar 31 2014 12:23:22 +00:00
Thank you saved my day..
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!!!
by Joe on Thursday, Jun 26 2014 22:44:32 +00:00
Worked perfectly. Thank you!
by radhey on Monday, Dec 01 2014 06:55:31 +00:00
Thanks its really helpful.
by Raju on Tuesday, Dec 02 2014 07:55:07 +00:00
Thank you very much ..for explanation
by Sundeep on Tuesday, Feb 17 2015 18:28:18 +00:00
Thank you. It work!
by Edward on Thursday, Mar 12 2015 17:13:12 +00:00
Thanks, it helps
by Sachin on Wednesday, May 20 2015 12:49:17 +00:00
by syed on Tuesday, Jun 02 2015 14:06:04 +00:00
Well Done guy.. you are genious..saved many lives. thanks a ton
Why still a problem with same adpations
by Why still a problem with same adpations on Friday, Jun 05 2015 05:40:35 +00:00
i'm using the tableAdapter in dataset try to get some data from Access 2003; this stupid err message still arised whatever setting... software: visual studio tools for applications of Infopath; Can someone light me in dark?
Anand Shah
by Anand Shah on Tuesday, Jun 23 2015 08:48:55 +00:00
Thanks it helped
by ert on Monday, Oct 26 2015 13:23:05 +00:00
for those who cant give FULL CONTROL to c:\windows\temp like me [this is how i solved] 1- run cmd AS admin (keep it open ). 2- open task manager and KİLL explorer.exe. 3- goto previously opened cmd. write explorer.exe hit enter. 4- go to c:\windows temp (right click)>properties ->security 5- now you will be able to change \IIS_IUSRS to Full Control note: some application may give error about elevated exploer.exe . it will be fixed after restart. if you dont wanna restart; [take explorer.exe out of Administrator mode] 1- goto previosly opened task manager. kill explorer.exe 2- in task manager file-> start new process write there explorer.exe 3- now the explorer.exe is in normal mode. http://stackoverflow.com/questions/5946618/asp-net-cannnot-access-to-windows-temp-folder/33346817#33346817 http://serverfault.com/questions/694184/cannot-provide-permission-to-iis-iusrs-on-c-windows-temp/731681#731681
by Anis on Tuesday, Nov 10 2015 05:32:17 +00:00
Thanks. Problem solved.
by Vineet on Wednesday, Dec 30 2015 11:14:32 +00:00
I must thank you so much since I struggled with this for many hours.
Wafa Khan
by Wafa Khan on Monday, Mar 07 2016 06:50:08 +00:00
Thanks a lot. Worked Perfectly :)
by Enoch on Wednesday, Jul 20 2016 16:34:05 +00:00
Thank you so much. This really helped me. Bingo!!!!