IIS error Login failed for user 'NT AUTHORITY\NETWORK SERVICE Print
Written by Tom   

 

If you experiencing the IIS error IIS error open database "My_DB" reqested by the login. Login failed for user 'NT AUTHORITY\NETWORK SERVICE' after seeting the connectionstring followthe below instructionsto fox the error.

 

  • First thing is to check the connectionstring is set properly.


1. Goto the intpub>www>my_website>web.config open the web.config file

2. The connectionstring should similar to

<connectionStrings>
<add name="My_RosteringConnectionString" connectionString="Data Source=MG-PC\SQLEXPRESS;Initial Catalog=My_DB;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

 

  • If these setting are correct follow the below instructions to fix the issue in SQL Sever Management Studio


1. Open the SQL Server 2008/2005 Management Studio



2. On the left pane below Databases click on Logins 

3. Under the logins you will see NT AUTHORITY\NETWORK SERVICE

If you don't see NETWORK SERVICE

5. Right click Logins > New Login...

6. Click the search button



7. In the next window Select User or Group click Advanced button

8. In the nex window click ind Now button, this will populate the user table

9. Find NETWORK SERVICE and click OK



10. You will now see NETWORK SERVICE in the SQL Logins

11. Right click the NETWORK SERVICE and click on Properties



12. In the Login Properies window click on User Mapping

13. In the next window click on the database you are trying to access

14. On the lower pane tick the check box db_Owner and click OK

 

If this doesn't fix the issue you may have to set the application pool in the IIS to LocalSystem click here for instructions.