Last post Nov 01, 2011 09:52 AM by mkonanki
Jan 04, 2010 07:48 PM|Jackxxx|LINK
Any Ideas on how to fix this issue?
Visual Studio 2005, Windows 7 64bit, SQL Server 2005 Express
Cannot open database "sql2" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'.
Jan 04, 2010 07:51 PM|dotnetruler|LINK
Jan 04, 2010 08:36 PM|Jackxxx|LINK
Turns out the issue was with IIS 7.5 and the default Identity setting, it is set to ApplicationPoolIdentity and Not NetworkService.
Mar 24, 2010 02:06 PM|ckenk|LINK
Hi Jackxxx & dotnetruler,
Thanks for your posts...helped me to solve the issue after few hours of head scratching and a good night sleep.
But one thing...Jackxxx, it would have been helpful to know where you changed the settigns for "ApplicationPoolIdentity" for a newbie like me :-). I did some search and found I can change them as shon in the image below (and hope I did it the right way,
coz my ASP.net application started working!)
[Edit: noticed the image does not show up properly in R.H.S], So just select Application Pool -> a pool entry -> Advanced Settings... (from Edit Application Pool section) -> Process Model (from Advanced Setting dialog box)
[Thanks http://www.sharemyimg.com/ for allowing to upload image files and to share them !]
"ASP.NET and SQL Server"
Login failed for user IIS APPPOOL\DefaultAppPool
Aug 06, 2010 05:03 PM|timr30017|LINK
Please tell me where you found this setting to change it. I've been fighting with this error for way too long now and I do not know IIS 7.5 or ASP.Net too well yet and I cannot find where to change this.
Please feel free to e-mail me direct at
I sure will appreciate it as I need to get this solved today before my customer has a fit.
Aug 06, 2010 05:14 PM|Jackxxx|LINK
Open IIS, double click your PC name under Connections, Click Application Pools, Select your app pool (DefaultAppPool), Then under actions on the right click Advanced Settings, Go to Process Model section and click on Identity. Now select NetworkService.
To open IIS, click your start button and enter IIS into the search field.
hope this helps.
Aug 06, 2010 05:22 PM|timr30017|LINK
Sorry for not reading the entire posts...
I changed the DefaultAppPool identity to a couple different things and it kept failing
So just for fun I figured I'd change it to my username/password by specifying the account and finally it began working....
But could that be a security risk/issue? Is there something in the Windows security somewhere I might need to change so that Network Service will work instead of having to use my Administrator account?
Thanks so much for your help.
Aug 22, 2010 07:27 AM|orad|LINK
Your user credentials work probably because you are an Administrator on that machine. The problem is that the connection will fail again if you change your password later.
Aug 25, 2010 03:05 PM|sassyboy|LINK
@dotnetruler Your solution rocked.
I am surprised why that wasn't marked as answer as well! It explains in detail what to do.
Also wondering, when changing the Identity of the app pool to network service, I noticed Application Pool Identity as being recommended. Why change to Network Service? Why not just add the default app pool user in Sql server logins and give it access to
Sep 13, 2010 08:39 PM|mike300zxt|LINK
ckenk, if you set it up to run as Network Service, you're not leveraging the new security features of IIS. You should leave that setting as-is (i.e. ApplicationPoolIdentity).
What you want to do is go to your SQL server, and add an SQL login for "IIS APPPOOL\DefaultAppPool".
The reason MS stopped using NETWORK SERVICE or LOCAL SYSTEM is that there can be security issues between processes sharing those accounts.
Alternately, you can create a restricted domain account, and use it as your Application Pool process identity, and grant it permissions to your database.
Sep 16, 2010 03:34 PM|orad|LINK
Unfortunately I never could find a user with the name "APPPOOL\DefaultAppPool" on my Win 2008 system so I always have to switch to "Network User". Any ideas how to give permissions to DefaultAppPool?
Sep 16, 2010 04:09 PM|mike300zxt|LINK
Because it's not a real windows account, you can't user the "Search" button. Just enter the account name 'IIS APPPOOL\DefaultAppPool', set your security settings, and click OK.
Sep 16, 2010 04:49 PM|orad|LINK
Great! Thanks for the quick reply. I'll try that for SQL.
I also figured DefaultAppPool impersonates IIS_IUSRS. So for my web application that needed write access to the application folder, I just needed to give Write access to IIS_IUSRS.
Oct 19, 2010 11:47 AM|jobran456|LINK
Oct 20, 2010 06:09 AM|orad|LINK
Thanks jobran456 for reply, but this thread suggests not to use NetworkService
in IIS 7+ due to security considerations. Instead it is recommended to use
ApplicationPoolIdentity as default Identity setting. This is by default in IIS 7 and later but you need also check for the followings (summarized from this thread):
SQL IIS7 NetworkService ApplicationPoolIdentity DefaultAppPool
Jan 12, 2011 09:33 AM|rathinakumarb|LINK
Excellent solutions from many people thanks for your support like this .... cheers :)
Feb 27, 2011 12:15 AM|KaNanga|LINK
Thank you, your solution worked for me!
Mar 17, 2011 09:06 AM|bojangles|LINK
Thanks mike300zxt that worked for me too, I had to then cick Server Roles and tick sysadmin also, I hope that doesnt open up any can of worms.
Jul 20, 2011 06:44 PM|Chiramisu|LINK
I prefer matching the IIS defaults to the SQL Server settings. Open your SQL Server Configuration Manager by opening "Run..." and running "sqlservermanager10.msc." Check the "Log On As" (by default "LocalSystem") of your SQL Server (it should be "running").
Now open your IIS Manager by running "," in the left panel click "Application Pools," then in the right panel click "Set Application Pool Defaults..." In the "Process Model" section of the dialog which pops up, select the same login method as your SQL Server
that we checked earlier. I'm using the default setting, so on my local machine for development I use "LocalSystem" for both.
Alternatively you can configure a new "Login" under the "Security" folder on SQL Server as others have mentioned. The easiest way to do this is using SQL Server Management Studio.
I prefer my approach though because then I don't have to change my connection strings and authentication method for SQL Server.
Nov 01, 2011 09:52 AM|mkonanki|LINK
For windows 7 use below link, which is working well