This is a migrated thread and some comments may be shown as answers.

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

3 Answers 458 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Duncan
Top achievements
Rank 2
Duncan asked on 29 Aug 2011, 10:33 PM
I have a console app that accesses and uses my DAL perfectly, as soon as a switch over to ASP.NET website i get the following error... I must be missing something that allows the web app to access the DB. Could someone help me figure out what i am missing please...

Exception Details: Telerik.OpenAccess.RT.sql.SQLException: Cannot open database "MyDB" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

3 Answers, 1 is accepted

Sort by
0
N Mackay
Top achievements
Rank 1
answered on 30 Aug 2011, 11:42 AM
You might need to add the connection string to your web.config file in your asp application.

0
IT-Als
Top achievements
Rank 1
answered on 31 Aug 2011, 06:38 AM
Hi Duncan,

The Application Pool that is associated with the website runs under a specific credential.. It seems like it is NT AUTHORITY\NETWORK SERVICE for your application pool.
For this to work you need to add the NT AUTHORITY\NETWORK SERVICE as a login to the SQL server database you're using for your website. You can add it with the Microsoft SQL Server Management Studio under "Logins" (right click and choose "New login") for your server. As  Login Name under "General" in the "New Login" screen you type NT AUTHORITY\NETWORK SERVICE.   Under "UserMapping" you tick the database backing your website.

Regards

Henrik
0
Nikola
Telerik team
answered on 01 Sep 2011, 03:55 PM
Hi Duncan,

Is the problem solved? Both of the previous answers are valid, but if your problem still exists I would ask you to give us a bit more information and send me the connection string in your App.config. It would be also useful is you could provide us with a screenshot of the authentication settings of your web application from the IIS.

You should also check if the connection string in the web.config of your web application is the same as the connection string in the DAL.

I'm looking forward to your feedback.

Kind regards,
Nikola
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

Tags
Getting Started
Asked by
Duncan
Top achievements
Rank 2
Answers by
N Mackay
Top achievements
Rank 1
IT-Als
Top achievements
Rank 1
Nikola
Telerik team
Share this question
or