Windows service - Login failed for user 'NT AU

2019-08-17 07:37发布

问题:

I've created simple console log app which behaves a windows service.

I'm wondering why am I getting an error

Login failed for user 'NT AUTHORITY\SYSTEM'

if I change my connection string in a way to use some another user which I previously created on SQL Server.

Example of connection string:

<value>Data Source=DESKTOP-Z67;Initial Catalog=MyDb;Integrated Security=false;User ID=service;Password=test1234</value>

Event if I specified this connection string, I'm getting error

Login failed for user 'NT AUTHORITY\SYSTEM'

Why isn't there an error like

Login failed for user 'service'

because I'm using that specific user in the connection string..

PS: I know how to fix this, I can go to SQL Server and edit this user NT AUTHORITY\SYSTEM to system admin, but I'm wondering why my app is trying to connect with this user instead of my user from connection string...

Thanks guys

Cheers