none
Connecting to MSDB store: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' RRS feed

  • Question

  • Hi,

    I'm trying to connect to SQL MSDB store using ADO.Net SQLConnection class in the windows authentication mode using c#.

    Connection string I'm using is "Data Source=datasource; Initial Catalog=msdb; Integrated Security=True".

    When the control reaches connection.open() in the code, it errors out with the message

    Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

    I made sure that I'm an admin on the SQL machine and my 'user' object is mapped to MSDB db .

    Any suggestions?

    Thursday, April 7, 2011 4:49 PM

Answers

  • Even though you are an administrator, it looks like your application is running under 'NT AUTHORITY\ANONYMOUS LOGON' account, and, since SQL Server does not grant permissions to that account, the connection is refused. Depending on type of application you would need to take different steps. If it is an ASP.NET application you can disable impersonation and then your account will be used to connect to the database. If it is not ASP.NET application, but, for example, Windows Server application then you can configure it to run under specific domain account and then grant permissions for this account to access database server.


    Val Mazur (MVP)

    http://www.xporttools.net

    • Marked as answer by ShashiV Wednesday, April 20, 2011 4:32 PM
    Wednesday, April 20, 2011 9:56 AM
    Moderator

All replies

  • I'm going to assume this is a web app (ASP.NET?) since the Anonymous account is being used. I don't know where your SQL Server is located but I will assume that it is on the same machine as the web server. First, is the app configured for Basic or Windows authentication? Is Impersonation enabled in the Web.config file? 


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, April 7, 2011 5:26 PM
  • Hi Geek,

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 
     
    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 20, 2011 2:03 AM
    Moderator
  • Even though you are an administrator, it looks like your application is running under 'NT AUTHORITY\ANONYMOUS LOGON' account, and, since SQL Server does not grant permissions to that account, the connection is refused. Depending on type of application you would need to take different steps. If it is an ASP.NET application you can disable impersonation and then your account will be used to connect to the database. If it is not ASP.NET application, but, for example, Windows Server application then you can configure it to run under specific domain account and then grant permissions for this account to access database server.


    Val Mazur (MVP)

    http://www.xporttools.net

    • Marked as answer by ShashiV Wednesday, April 20, 2011 4:32 PM
    Wednesday, April 20, 2011 9:56 AM
    Moderator
  • Thanks Alan for the follow-up. Got it done using impersonation.

     

    - Shashi


    - Shashi
    Wednesday, April 20, 2011 4:48 PM
  • Thanks VMazur.

    - Shashi


    - Shashi
    Wednesday, April 20, 2011 4:48 PM