I'm programming a Service Worker for Windows Server using Visual Studio 2022. Upon installation, the following error arises:
"Windows cannot start the xxxxx service on the local computer.
Error 1053: The service did not respond to the start or control request in a timely manner."
Upon checking the Windows Event Viewer, I encountered this error:
"User 'NT AUTHORITY\SYSTEM' login failure. Reason: Failed to open the explicitly specified database 'Bunker'. [CLIENT: ]"
During debugging in VS 2022, there are no connection errors; they only occur upon installation.
I've already verified the user and their permissions in the SQL Server database. Additionally, I attempted to reinstall the service worker.
I'd appreciate some assistance in resolving this issue.
Here is the code snippet for the database connection.
You have to choose between Windows Authentication or SQL Server authentication. You are attempting to use both, and it appears that Windows Authentication is chosen. The error occurs since the user that the service is running under does not have a valid Login with that instance.
To use Windows Authentication, make sure the user has a valid login with the instance and remove user name
and password
while keeping Integrated Security
on the connection string.
To use SQL Server Authentication, remove Integrated Security
and keep the user name
and password
on the connection string.