3

I tried to open the website from a broswer. The project is deployed at an IIS server.

I am getting this exception:

Exception information:

Exception type: SqlException

Exception message: Cannot open database "TestDB" requested by the login. The login failed.

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

Any solution?

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
kumar
  • 1,117
  • 13
  • 34
  • 58
  • `The login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.` isn't that pretty self-explanatory? – Pekka Apr 06 '10 at 09:37
  • that it is not self explanatory.when i try to access the web application i am getting that error in eventviewer it is showing that error.even through i havce permission to access the app. – kumar Apr 06 '10 at 09:42
  • It seriously is self explanatory as Pekka says. You should realise that your IIS application runs under the NT AUTHORITY\NETWORK SERVICE account. Is the intention that it should run under the account of the user browsing the site (i.e. is it an Intranet application for example) – Martin Smith Apr 06 '10 at 09:56
  • Duplicate of http://stackoverflow.com/questions/2251839/login-failed-for-user-nt-authority-network-service – marc_s Apr 06 '10 at 09:58
  • possible duplicate of [ASP.NET Login failed for user 'NT AUTHORITY\NETWORK SERVICE'](http://stackoverflow.com/questions/2421937/asp-net-login-failed-for-user-nt-authority-network-service) – legoscia Jun 11 '14 at 12:51
  • try to take a look at the following links. [Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.](http://stackoverflow.com/questions/2251839/login-failed-for-user-nt-authority-network-service) [Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.](http://stackoverflow.com/questions/2421937/asp-net-login-failed-for-user-nt-authority-network-service) [The error “Login failed for user ‘NT AUTHORITY\IUSR’” in ASP.NET and SQL Server 2008](http://stackoverflow.com/questions/1269706/the-error-login-failed-for-user-nt-authority-iusr-in-asp-net-and-sql-server-2) – Morten Anderson Apr 06 '10 at 09:57

2 Answers2

3

Your IIS application runs under the NT AUTHORITY\NETWORK SERVICE account

You can use Windows Authentication and Impersonation http://msdn.microsoft.com/en-us/library/aa292118%28VS.71%29.aspx

Use Windows Authentication and a fixed account (either by adding the NT AUTHORITY\NETWORK SERVICE account to SQL Server or by creating a new account for that purpose and configuring the application pool in IIS to use that account)

Or you can use SQL authentication with user name and password in the (possibly encrypted) connection string in the web.config

Martin Smith
  • 438,706
  • 87
  • 741
  • 845
0

The service user account 'NT authority network service could not be created??? if you are facing issue while entering superuser password re-password and you are using postgresql version --postgresql-10.16-1-windows then plz go for older version that is postgresql-10.15-1-windows