Security – ASP.net user account permissions in IIS 7 on Windows 2008 server

asp.netiis-7log-filesSecurity

I set up a global error handler in my ASP.net application, using Log4Net and a RollingLogFileAppender which has worked quite nicely up until.

I'm in the middle of an upgrade to IIS 7 on Windows 2008 server, and I can't get the logging working. I think errors are being raised, but ASP.net doesn't have the permissions needed to write to the specified folder. Now, I would normally just grant full rights to the ASPNET user and be done with it, except that user account does exist anymore. Also, I can't find the "Everyone" user group either. I don't want to go fooling around creating new user accounts, setting up impersonation etc etc. Is there an easy solution?

Best Answer

In IIS6 and IIS7, the equivalent for ASP.NET to the ASPNET user is the application pool identity user. By default that's NETWORK SERVICE in IIS7, and the App Pool identity in IIS 7.5+. You can grant that user permissions to disk and it will work.

The 'better' way is to create custom users per app pool and assigning them permission to disk so that the sites are isolated from each other, and so that other applications on the server that use Network Service can't access the content of your sites. However that's a judgment call that you need to make in your situation.

The other user that comes into play is the anonymous or authenticated user of your site. That's defined in the authentication -> anonymous section of your site. In IIS7 I recommend setting that to use the app pool identity, as long as you only have 1 site per pool, or as long as each site in the app pool highly trust each other. Then you only need to maintain 1 user on disk.