SQL Server Login failed for user 'NT AUTHORITY\LOCAL SERVICE' in window service

ig9co6j1  于 2022-12-22  发布在  其他
关注(0)|答案(3)|浏览(325)

I had just created a window service app and it is throwing exception Login failed for user 'NT AUTHORITY\LOCAL SERVICE' I have tried to have user id and password but it does not work on it
and go through this reference SQL Server Login error: Login failed for user 'NT AUTHORITY\SYSTEM' and created a new user on that database but again that exception

5vf7fwbs

5vf7fwbs2#

Are your service and the service running on the same machine? If they are not it is not the same 'LOCAL SERVICE' user on both machine and it will not work. If they ARE on the same machine using this connection string with no username or password:
Server=localhost;1433;Database=myDataBase;Trusted_Connection=True;

wmomyfyw

wmomyfyw3#

"DefaultConnection": "Server=(local);Database=Main_DB;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True",

for .Net 7.0 make sure TrustServerCertificate is available.

相关问题