Login failed for user 'IIS APPPOOL\ASP.NET v4.0'




Login failed for user 'IIS APPPOOL\ASP.NET v4.0', Login failed for user 'IIS APPPOOL\myapppool', Application Pool, Cannot Open Database For User, IIS APPPOOL\ASP.NET v4.0, ASP.NET v4.0, db_datareader, db_datawriter, Databse Role Membership, Give Access For User 'IIS APPPOOL\ASP.NET v4.0', Asp.Net, IIS

Web Application that are hosted on IIS try to access the database using the application pool. Sometimes the application pool does not have sufficient permission to access the database. In such situation, this error happens.




First of all on SQL Management Studio, navigate to Database--> Security--> Users Check whether the User IIS APPPOOL\ASP.NET v4.0 is listed or not?. If not present, create new user by right clicking the Users icon as shown below.

Login failed for user 'IIS APPPOOL\ASP.NET v4.0', Login failed for user 'IIS APPPOOL\myapppool', Application Pool, Cannot Open Database For User, IIS APPPOOL\ASP.NET v4.0, ASP.NET v4.0, db_datareader, db_datawriter, Databse Role Membership, Give Access For User 'IIS APPPOOL\ASP.NET v4.0', Asp.Net, IIS

On User Name section give the name as IIS APPPOOL\ASP.NET v4.0 as shown below.

Login failed for user 'IIS APPPOOL\ASP.NET v4.0', Login failed for user 'IIS APPPOOL\myapppool', Application Pool, Cannot Open Database For User, IIS APPPOOL\ASP.NET v4.0, ASP.NET v4.0, db_datareader, db_datawriter, Databse Role Membership, Give Access For User 'IIS APPPOOL\ASP.NET v4.0', Asp.Net, IIS

On Databse Role Membership section, check both db_datareader, db_datawriter. Click OK button and browse again. This will definitely resolve the issue.