While deploying web based and Mobile based Attendance system on IIS and MSSQL2017, I got following error.
To resolve this issue, simply create User named 'IIS APPPOOL\apppoolname in SQL
After creating user, assign it to your respective database and give db permissions to that user.
This will resolve the issue.
- Project developed using Entity Framework Core and MVC .net Core 2.2
- To deploy web application in IIS, I published core 2.2 web application and put it under IIS.
- Assigned new APP Pool with with No Managed Code for .NET CLR Version.
An unhandled exception occurred while processing the request.
SqlException: Cannot open database "DATABASE" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\apppoolname'.
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, object providerInfo, string newPassword, SecureString newSecurePassword, bool redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, bool applyTransientFaultHandling, string accessToken)
To resolve this issue, simply create User named 'IIS APPPOOL\apppoolname in SQL
After creating user, assign it to your respective database and give db permissions to that user.
This will resolve the issue.
0 thoughts on "SqlException: Cannot open database "DATABASE" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\APPPOOLNAME'."