Posts Tagged ‘iis apppool’

Login failed for user ‘IIS APPPOOL\DefaultAppPool’.

October 18th, 2009

If one uses trusted connection to a sqlserver database under Windows 7 and II7 one might get the error message “Login failed for user ‘IIS APPPOOL\DefaultAppPool’.” when trying to run a web application.  There are several articles for this but all points to a different GUI than mine (earlier versions of Windows7/IIS7?).

Update: as I lightly noted, to give the apppool SystemLocal rights is Not the right way to go.

Set up the application pool in IIS

Fire up Internet Information Services Manager.  (windowbutton-iis-return)

Find the Application Pools item in the Connections toolbar.  One can reuse the default application pool or create a new one.  Go for the latter since it is slightly more complicated and hence more fun.

or in Win8:

Add application pool in Win8

(I don’t grok what Managed pipleline mode does.)

Select your newly created application pool and the advanced settings.  Change the Process model to LocalSystem.
(I had planned to create a “better” account with the proper limited rights but ran out of time.  Someone else…?)

Update: Don’t change to LocalSystem, instead add the user to allowed SQLServer logins as noted in the bottom here.  I suggest “IIS AppPool\MySite” for now.

The recommended Microsoft solution is to create a separate account. However, if your solution is small, you can instead add the ‘IIS APPPOOL\DefaultAppPool’ user as a database user in your SQL instance, then providing the proper ‘User Mappings’ to the databases you need the DefaultAppPool user to access. You may not necessarily be able to search for this user, but you can still enter it in the ‘Login name’ field in the “Login – New” window as “IIS APPPOOL\DefaultAppPool” (without the quotes).

Follow this link as a reference and pay attention to the last post: http://social.msdn.micro…-4a71-a448-3e3eef9ee404/

Application pool settings

Getting to advanced settings.

Getting to advanced settings.

 

Application pool advanced settings

Application pool advanced settings

Site settings

Now change your web application to use this application pool.  This could be made simpler by moving the menu for this to the same place as the other menus.  To make the story short – select your site and look to the right of the IIS manager.

Site advanced settings

Site advanced settings.

Site advanced setting IIS7

Site advanced setting IIS7.

Application pool

Application pool.

Application pool in IIS7

Application pool in IIS7.

 

Set up Sqlserver

Honour those who should.

To add a new user to SQLServer go to your database->security and add user connected to IIS APPPOOL\DefaultAppPool.  This way the user can log in to the database.

Sqlserver -> new login

Sqlserver -> new login.

New login to database

New login to database. Don’t forget to change default database to appropriate.

Then go to the SQLServer->security and add this user to be allowed to login to the server through the user and properties.

The users of a database

The users of a database.

 

That is all there is to it.