Problems connecting to windows server

I need your help!!!!

I want to connect to sql server from windows service, but this excludes the following:

Login failed for user NT AUTHORITY \ ANONYMOUS LOGON '.

My connection string is declared as follows:

<add name="CoreConnectionString" connectionString="Data Source=10.10.2.102;Initial Catalog=DataBaseName; Integrated Security=True" providerName="System.Data.SqlClient" /> 

When I use the username and password instead of Integrated Security = True, it works, but I cannot use the username and password during the final deployment.

What is wrong, what can I do?

+4
source share
1 answer

When you define Integrated Security=True in the connection string, any user who is currently logged in will try to connect to your database. When you run this application in the console or Winforms, this is your user account.

However, if you run it as a Windows NT service, this is the service account that the service runs on - in your case obviuosly NT AUTHORITY\ANONYMOUS LOGON .

And the error says clearly: this user account does not have permission to connect to SQL Server.

You have several options:

  • stop the NT service and change the service account to be the one who has access to SQL Server

  • allow NT AUTHORITY\ANONYMOUS LOGON register on your SQL Server and use your database

  • create a specific user (for example, an application user) in your SQL Server and change the connection string to use this user:

     connectionString="Data Source=10.10.2.102;Initial Catalog=DataBaseName; user id=Your-Application-User-here;password=The-Secret-Password" 
+8
source

All Articles