Windows could not start the service on local computer. Error 5 Access is denied


In this article we will see how to resolve the below error while starting a Windows Service in Services.msc windows. Windows Service is developed using Visual Studio tool: Windows could not start the service on local computer. Error 5 Access is denied

In this article we will see how to resolve the below error:
Windows could not start the service on local computer. Error 5 Access is denied.

When I installed the Windows service using the installutil utility in visual studio command propmt and started the windows service from Services.msc, i got the above error.

When I opened the Windows Service code in Visual Studio and Go to properties of serviceProcessController it was running the service under User Account. I then changed the "Account" to "LocalSystem". Uninstalled the service using installutil -u servicename from command propmt then Build the service and installed the service using installutil servicename from visual studio command propmt then it worked.

When the service is running under "User" account, it prompts for a valid username/password when the service is installed and runs in the context of an account specified by a single user on the network.

"Local System" account runs in the context of an account that grants extensive local permissions. This account is very much powerful and allows you to perform almost every action.

So you need to carefully choose when developing a windows service whether to use "User" or "Local System" account. There are other account tyoes available such as "Local Service" and "Network Service".


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: