Debugging start error for windows service C++

I have a server that I have tested as a standalone console application which works fine. I added the standard boilerplate code for making it a C++ Windows service. It seems to install fine but upon starting I get an error 1053. Which just means the service failed to start up in a reasonable time. I extended the timeout for startup in the registry with no luck and don't see any more detail about the failure in the event logs so I was hoping to be able to try and debug the problem by starting the debugger when the service attempts to start. I added the following to the registry:
---------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ntlocalservice.exe]
"Debugger"="c:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\windbg.exe -y srv*d:\\apps\\windows\\symbols*https://msdl.microsoft.com/download/symbols"

----------------------

But the service still fails the same way. I also did enable the "Allow service to interact with desktop" Log On tab property setting in the Services manager for the service.

Any ideas on how to debug or better log the error during the initialization/starup?

-Scott

Did you forget to call "SetServiceStatus()" with 'SERVICE_RUNNING'? If you didn't then it's possible that your service is actually running in memory, but the Service Manager doesn't know that because you're handler didn't respond. You'll be able to see it in Task Manager if that is the case.
Topic archived. No new replies allowed.