开发者

Use NT authentication for SQL Server in windows service

开发者 https://www.devze.com 2023-02-10 19:12 出处:网络
I\'m trying to connect to SQL Server using Windows authentication. Th开发者_StackOverflowe code works fine when I run it as a plain executable but when I put it in a Windows service I get the error: L

I'm trying to connect to SQL Server using Windows authentication. Th开发者_StackOverflowe code works fine when I run it as a plain executable but when I put it in a Windows service I get the error: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

I tried passing the username and password via the connection string but that doesn't help.

Any ideas?


If you're running as a servie, you'll need to change the logon identity for the Windows Service.

  1. Start > Run > Services.msc
  2. Right-click on the service in "Services"
  3. Choose the "Log On" tab
  4. Enter the account name and password for the domain user into the "This account", "Password" and "Confirm password" boxes
  5. Click "OK"
  6. Restart the service

When configuring a process to connect to Sql Server via Integrated Authentication you don't/can't specify the username/password combination in the connection string.


Configure the service to run as an account with access to SQL Server. Service Properties - Log On - This account

0

精彩评论

暂无评论...
验证码 换一张
取 消