Login failed for user 'IIS APPPOOL\web2'
Error:
I am getting following error while openning connection with Database from asp.net application.
[SqlException (0x80131904): Login failed for user 'IIS APPPOOL\web2'.]
Here on the database I have windows authentication and connection string in web.config is set accordingly and given below:
Data Source=.;Initial Catalog=<DB Name>;Integrated Security=true;Persist Security Info=False;" providerName="System.Data.SqlClient"
In IIS:
I have a website which is using "web2" and this app pool is running under the identity of "ApplicationPoolIdentity".
Solved solution:
Under SSMS expand the security right click on logins and select "New Login". In the New Login dialog, enter the app pool(IIS APPPOOL\web2) as the login name and click "OK". You can then right click the login for the app pool, select Properties and select "User Mapping". Check the appropriate database, and the appropriate roles.