To read the second part of series. Click here.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE
When you first time publish your application to server and make it live. You might be face this error.
"Cannot open database requested by the login. The login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
This is very common error raised when you conifugure the application with IIS. Here IIS face the permission issue when tries to login into SQL Server.
To fix the issue, you have to create a new user and add the database roles to it. Follow these steps to fix the issue.
1. Login via SQL Server Management Studio
2. Go to the “Security” directory of the desire database
3. Right-click the “Users” directory
4. Select “New User…”
5. Add ‘NT AUTHORITY\NETWORK SERVICE’ as a new user
6. In the “Database Role Membership” area, select “db_datareader” and “db_datawriter”.
7. Click “OK”
Here is the screenshot of the above workflow: