Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’

asp.netconnection-stringiis-7sql-server-2008web.config

I been strugling with this for 2 days now without comming any closer to solution. I have read 20-30 threads alteast and stil can not resolve this.

Please help me out.

I have disable anonymous authentication, enable asp.net impersonation.

I have added <identity impersonate = "true" />

I have added the a user to the security logins that is connected to the database I try to connect to

This is the connectionstring I use:

Data Source=IPTOSERVER;Initial Catalog=Phaeton;User Id=User;Password=Password;

errormessage:

Cannot open database "Phaeton.mdf" requested by the login. The login failed.

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Best Answer

I was experiencing a similar error message that I noticed in the Windows Event Viewer that read:

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Reason: Failed to open the explicitly specified database. [CLIENT: local machine]

The solution that resolved my problem was:

  1. Login to SqlExpress via SQL Server Management Studio
  2. Go to the "Security" directory of the database
  3. Right-click the Users directory
  4. Select "New User..."
  5. Add 'NT AUTHORITY\NETWORK SERVICE' as a new user
  6. In the Data Role Membership area, select db_owner
  7. Click OK

Here's a screenshot of the above: Screenshot of adding new user Network Service as db_owner to SqlExpress