Question

I've been spending a lot of time reading about the sc.exe to run an executable as a Windows Service and it seems it should be fairly straighforward bu I'm having some issues get it to work without this error: error 1053 the service did not respond or control request in a timely fashion.

I get the service to install and it is in the list of services but it is not allowing me to start it. This is what I'm using just a basic attempt:

>sc create TestService binPath= "C:\Program Files (x86)\[path.exe]" DisplayName= "TestingServices" start= auto

What am I doing wrong? Does my exe that I'm trying to run as a service have to be setup to properly be run as a service? I don't think that's the case because there are programs out there that can run any exe as a service. I'm trying to do the same, how can I do this?

Était-ce utile?

La solution

You can't just run any executable as a service; The executable needs to be written specifically to incorporate a service loop. The service loop recieves control requests (eg. start, stop, restart, suspend) and must perform processing such as initialisation for start, cleanup for stop, etc and respond to those control requests, otherwise the service control manager will kill it.

Autres conseils

Try to use

C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe Assembly.exe|dll

instead.

I have the same problem 3 months ago.. I've just check this sample. Then do the same syntax as you did. Then voila! It went good!

@UndefinedBehaviour is correct, there are some work arounds though

  • SrvAny.exe - from WinNT Resource Kit, looking fairly long in the tooth now
  • firedaemon - third party commercial product
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top