Pages

Search This Blog

Thursday, January 31, 2008

Compiler Error Message: CS0016: Could not write to output file 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\xxxxxx\xxxx

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0016: Could not write to output file 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\wholesales\xxxxx\xxxxx\App_Code.xxxxxxx.dll' -- 'Access is denied. '




After some antivirus activities, my partner development machine face issue above.

This may due to some permission setting in Temp folder. To solve it,

1. Go to %Systemroot%, normally C:\WINDOWS or C:\WINNT
2. Right-click the Temporary folder (mine is C:\WINDOWS\Temp) and select Sharing and Security. Select the Security tab and take a look at the list of “Group or user names:”
3. NETWORK SERVICE should be in the list. If it is not, click Add and type Network Service in the text box:

4. Make sure NETWORK SERVICE have Full Control in the Permissions list.

5. Click OK.

6. Restart IIS (Run iisreset)

Test on the web, and it solved.





If you still have the same problem, please check whether you are using McAfee antivirus. If yes, it's probably cause by the access protected properties setting in mcAfee antivirus. Please make sure you unchecked "Prevent execution of scripts from the Temps folder" in "Access Protection Properties"
To do so, right click on McAfee icon in Taskbar and Click on "VirusScan Console..."


Double click on "Access Protection" and a new "Access Protection Properties" window will pop out. Make sure you unchecked "Prevent execution of scripts from the Temps folder" under Block column. Click OK to close all the window.


Problem should be solved.

24 comments:

Unknown said...

An FYI for other interested parties - I got this same error doing some dev in VS2003 and it was McAfee that turned out to be the problem. A rule had been applied to the server to stop write access to EXE's for the TEMP folder.

Anonymous said...

Got the same error.
In my case i had to add the TEMP variable to the system environment variables:

1. Open system properties. Click on tab Advanced. Then click on Environment Variables.
2. Check if a System Variable TEMP is defined and point to the temporary directory (in my case: %Systemroot%\Temp). If not add it.
3. Do an iisreset
4. Check the website again

Anonymous said...

Hola, gracias por el post, me ayudó a solucionar mi problema.

Pablo

Ramit Sengupta said...

Awesome solution sir !! It worked fine here..

Anonymous said...

Following settings worked for me. So I removed full permission to special permission for NETWORK SERVICE on temp folder
1. Open system properties. Click on tab Advanced. Then click on Environment Variables.
2. Check if a System Variable TEMP is defined and point to the temporary directory (in my case: %Systemroot%\Temp). If not add it.
3. Do an iisreset
4. Check the website again

Anonymous said...

Hours spent on this. I'm running IIS 7.0 with Vista Home Premium and a ASP.NET web application. Tried setting shares to all the folders in the folders in the compile error message. Would never have known to C:\WINDOWS\TEMP file. And... being a newbie at this and VISTA didn't know that I should also add NETWORK SERVICES as a permission group. Ugh... Much thanks sir.

Unknown said...

It's working perfectly..
Thnak you

Mastak said...

Same issue..
Thanks guys.. You saved my day.

jerrynixon said...

Thanks! Same problem. Same fix. ;)

Unknown said...

This post was great. Let me add a couple of bits of where the setup on my machine (Vista Home Premium with IIS7) differed from the post.

1) There was no 'NETWORK SERVICE' or 'NETWORK SERVICES' group. But there was an 'IIS_IUSRS' group. I applied the permissions to that group instead.

2) Some related posts say to look for the environment variables '%TEMP%' and '%TMP%'. On my machine they pointed to the temp directory from a user in the Administrator group. I made the changes to 'c:\windows\temp' (ignored those environment variables).

After making the change in the post the .asmx worked!

Anonymous said...

Hello there,

This is a question for the webmaster/admin here at www.blogger.com.

May I use part of the information from this blog post above if I give a link back to your website?

Thanks,
Peter

Anonymous said...

Hey,

I have a question for the webmaster/admin here at www.blogger.com.

May I use part of the information from your post above if I provide a link back to this website?

Thanks,
James

Unknown said...

Thank you very much, It helped me.

Shivoham said...

Thanks very much,

The proble resolved by giving access to network services in Windows\temp folder.

Shivoham said...

Thanks, it really helped me.

Only has given rights to network service in windows\temp folder.

Darrel said...

Problem Solved

Aijay Iphie said...

thanks. It worked for me.

Jim Gale said...

Even though the environment variable TEMP pointed to %USERPROFILE%\AppData\Local\Temp, and I already had an IIS_IUSRS on c:\windows\temp (but no rights), I had to give IIS_IUSRS full control on c:\windows\temp to make this work. This is likely because I ran the SetInAcl and other rights-changing system-wide things recently.

Thanks for posting and allowing users' posts.

TravelDan said...
This comment has been removed by the author.
TravelDan said...

You may want to check your Application Pool Identity settings too.

TravelDan said...

Yopu may want to check your Application Pool Identity settings

4opa said...

'IIS_IUSRS' group. I applied the permissions on %SystemRoot%\TEMP to that group.

This helped me! Thanks!

Faisal Shah said...

Thank you so much for just a great help.

Chern Dong said...

Problem solved after I granted IIS_IUSRS full control access rights in c:\windows\temp folder

Thanks!