5

I am trying to create a simple Windows Service. The User Account for the service is NetworkService. Then I ran installUtil from command prompt and I got this :

The Commit phase completed successfully.

The transacted install has completed.

which means the service got installed successfully. But when I try to run it from the Service applet i get this error :

Windows cannot the CustomersService service on Local Computer. Error 5 : Access is denied.

I am using 64bit Windows 7.

dckuehn
  • 2,427
  • 3
  • 27
  • 37
TCM
  • 16,780
  • 43
  • 156
  • 254

4 Answers4

7

I am not sure if you've already got this resolved though, the following helped me fix this on my system:

  • Grant full permissions to the service registry key under HKLM > System > Current Control Set > Services > <Service Name>. (Grant full permissions to Network Service Built in account on the key)
  • Check the image path (apparently the output path of the exe under the bin > Debug.
  • Add and give full permissions to the Network Service account here too.

This should help!

Jonas G. Drange
  • 8,749
  • 2
  • 27
  • 38
Vaibhav Singh
  • 71
  • 1
  • 2
6

I got an access denied error 5 when I tried to run a service under "LOCAL SERVICE" user, but under "LOCAL SYSTEM" the service did start. To run the service under "LOCAL SERVICE" I had to do the following:

  • Service set to run under "LOCAL SERVICE"
  • I gave permissions to the user "LOCAL SERVICE" for the folder where the executable of the service is located in. (Right mouse button om folder, properties, security, add user "LOCAL SERVICE" with as many rights as possible
  • Start service now

You can use procmon.exe of SysInternals to monitor the ACCESS DENIED error. Filter on "File System Activity" for the process "services.exe". You will probably see the path of the executable of the service that needs to be started in the "Path" column when the error "Access Denied" error code 5 occures.

Mike de Klerk
  • 11,906
  • 8
  • 54
  • 76
3

This worked for me

Go to the service in the service manager >> right click on that service and choose Properties >> Click the Log On tab >> choose the Local System account.

Then start the service.

Brian
  • 3,850
  • 3
  • 21
  • 37
Alexander Zaldostanov
  • 2,907
  • 4
  • 30
  • 39
2

Through which user account type are you trying to start/stop the service? Make sure the user has sufficient privileges to start/stop a service.

ajay_whiz
  • 17,573
  • 4
  • 36
  • 44
  • I am running under `NetworkService ` account. Doesn't this account already have the permission to start or stop the service? If not, how do i set it? Can you mention the steps? – TCM Sep 01 '10 at 06:01
  • @Nitesh I meant the user through which you have logged into the system – ajay_whiz Sep 01 '10 at 06:55
  • 1
    Nope. I found the solution. The solutions is :- http://stackoverflow.com/questions/574411/system-error-5-access-is-denied-when-starting-a-net-service – TCM Sep 01 '10 at 06:56