I have created a Windows service, which runs perfectly. I have also set up an installer. However, when I try to run this service on my local machine, it doesn't work, and it doesn't make any changes to my sql server database .
Loading
I have created a Windows service, which runs perfectly. I have also set up an installer. However, when I try to run this service on my local machine, it doesn't work, and it doesn't make any changes to my sql server database .
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Aymen AmriRank #1,022 · 1.9K reputationPosted Oct 23, 2023, 8:04 AM EDT
Hello Ishika
Maybe you could check following points :
I would recommend that you trace the execution of the service into a log file in order to have more details about the issue.
You can also run the installed service then debug your code from VS using the Debug ==> Attach to process
Sarthak VarshneyRank #46 · 32K reputationPosted Oct 30, 2023, 6:32 AM EDT
To give your local service permission to access your SQL Server database, you can follow these steps:
This will return the SID of your local service account.
GRANT CONNECT, SELECT, INSERT, UPDATE, DELETE ON database_name TO NT SERVICE\LocalService;Be sure to replace
database_namewith the name of your SQL Server database.Restart your SQL Server service. This will ensure that the changes you made take effect.
Restart your local service.
Once you have completed these steps, your local service should be able to access your SQL Server database.
Here is an example of how to grant the local service account the necessary permissions on a SQL Server database using SSMS:
Once you have granted the local service account the necessary permissions, you should be able to start your local service and it should be able to access your SQL Server database.