Document directory
After running a ASP. NET Website on IIS 7.5 for the first time on a Windows 7 computer, I was faced with the following error message:
Login failed for user 'IIS APPPOOL\ASP.NET v4.0'. Description: An unhandled exception occurred during the executionof the current web request. Please review the stack trace for moreinformation about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'IIS APPPOOL\ASP.NET v4.0'.
To fix this issue, try changing the (Process Model) Identity of your website's application pool to useNetworkServiceAccount (or the less secureLocalSystemAccount). By default, iis7 seems to set the application pools identity to 'applicationpoolidentity ', instead of NetworkService or LocalSystem.
Here's a step-by-step guide to determining your websites application pool, then changing its process model idenitty in iis7:
- OpenInternet Information Services (IIS) manger.
- InConnectionsSidebar, drill down into default web site and click on your website.
- Now inActionsSidebar (on right side), click onAdvance settings...In the popup box, under general you will see your application pool listed for your website (in my case the app pool is: ASP. NET v4.0 ).
- Click Cancel... If you choose, you can change the application pool here, but for the sake of this example we just wanted to find out what the website's app pool was.
Now that we know the application pool that is configured for are website, we now want to change the app pool's (Process Model) identity to 'networkservice', here's how:
- OpenInternet Information Services (IIS) manger.
- InConnectionsSidebar, click onApplication pools.
- Now right-click on theapplication pool that your website is using (in this case my site is usingASP. NET v4.0Application pool), and selectAdvanced Settings...From the menu.
- In the advanced settings pop-up box, locate the process model-> identity section and click on the application pool identity.
- In the application pool identity pop-up box, change the built-in accountNetworkService(Or if you want LocalSystem), Then clickOK,And clickOKAgain to save your advanced settings changes.
After changing the application pool's identity to NetworkService (or LocalSystem) You shoshould now be able to get your asp. Net Site to run successfully on a iis7 web server.
Source from http://www.gotknowhow.com/articles/fix-login-failed-for-user-iis-apppool-aspnet-v4-error-iis7