<connectionStrings>
<add name="xyzConnectionString" connectionString="Data Source=ServerName\Instance;Initial Catalog=XYZ;Trusted_Connection=Yes;" providerName="System.Data.SqlClient" />
</connectionStrings>
When I browse the application then got following error:
Source: .Net SqlClient Data Provider
Method: Void OnError(System.Data.SqlClient.SqlException, Boolean, System.Action`1[System.Action])
Error: Login failed for user 'IIS APPPOOL\ASP.NET v4.0'.
To resolve this I have found a solution after some googling, In IIS Application pool I have change identity for select Application Pool.
a. Right click on Application Pool
b. Go to advance settings
c. Change identity from ApplicationPoolIdentity -> LocalSystem
d. Click OK
When this problem resolved I have face another error that is:
Method: Void OnError(System.Data.SqlClient.SqlException, Boolean, System.Action`1[System.Action])
Error: Cannot open database "XYZ" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'.
Now its look like ball is on DB court, yes there is login name NT AUTHORITY\SYSTEM in security folder. Again googling and yes we can user mapping with desired database for login NT AUTHORITY\SYSTEM.
a. SSMS -> Security -> Logins -> Right click -> Properties
b. Select User Mappings
c. Map desired database and add db_owner database role.
d. Click OK
Yes this time error gone and page open and connected properly with database.


