Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

4 posts, 0 answers
  1. Duncan
    Duncan avatar
    93 posts
    Member since:
    Jul 2012

    Posted 29 Aug 2011 Link to this post

    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'.
  2. N Mackay
    N Mackay avatar
    228 posts
    Member since:
    Dec 2010

    Posted 30 Aug 2011 Link to this post

    You might need to add the connection string to your web.config file in your asp application.

  3. DevCraft banner
  4. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 31 Aug 2011 Link to this post

    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.


  5. Nikola
    Nikola avatar
    27 posts

    Posted 01 Sep 2011 Link to this post

    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,
    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 >>

Back to Top