Recently I faced an issue while database connectivity(SQL Server 2008 R2) on my Windows 7 machine for a web app.
Cannot open database "Database Name" requested by the login. The login failed.
Login failed for user ‘IIS APPPOOLDefaultAppPool’.
This issue was related to security.
I could resolve the issue by creating a login for user IIS APPPOOLDefaultAppPool and giving same user permission to respective database.
Steps-
First of all Login needs to be created for the user “IIS APPPOOLDefaultAppPool†in SQL Server.
Expand Security –> Right Click on Logins –> Click New Login…
Enter login name as “IIS APPPOOLDefaultAppPool†and Click OK.
To give the permission to the database
Right Click on the Database –> Properties
Select Permissions –> Click on Search
Click Browse then Select “IIS APPPOOLDefaultAppPool†user –> click OK –> click OK –> click OK
That’s it
Thanks