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?
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.