error cs0016 could not write to output file access is denied

[Originally posted by]:

I was struggling with this problem for a while. Found some solutions on the web that involved setting permissions on the “Temporary ASP.NET Files” directory in the error message. But even opening it up to “Everyone” didn’t work.

Then eventually the following steps fixed it:

  1. Go to the IIS AppPool for this site
  2. Right-click the app pool and go to Advanced Settings
  3. Change Identity from “ApplicationPoolIdentity” to “NetworkService”

There may also be some other necessary steps, which I did while troubleshooting, but this is the key step. For some reason the App Pool Identity (such as IIS_APPPOOL\SiteName) isn’t granted access when “Everyone” is. I’m sure someone else can shed some light on why this is the case… Hopefully this helps others resolve this frustrating issue.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s