Could Not Start Windows Service, Error 1064

Could not start Windows Service, Error 1064

Thanks to @Siderite Zackwehdex's comment, I was able to find the full stack trace of the underlying exception in EventViewer, under:

Windows Logs\Application

In my case, my service is named "HttpDispatcher", which appears in the "Source" column in the top pane.

I could see immediately it was due to a dependency issue where my .NET 4.7.2 project was not pulling across my .NET Standard references. (That ol' chestnut).

Event Viewer: Windows Logs/Application

Windows service on Local Computer started and then stopped error

If the service starts and stops like that, it means your code is throwing an unhandled exception. This is pretty difficult to debug, but there are a few options.

  1. Consult the Windows Event Viewer. Normally you can get to this by going to the computer/server manager, then clicking Event Viewer -> Windows Logs -> Application. You can see what threw the exception here, which may help, but you don't get the stack trace.
  2. Extract your program logic into a library class project. Now create two different versions of the program: a console app (for debugging), and the windows service. (This is a bit of initial effort, but saves a lot of angst in the long run.)
  3. Add more try/catch blocks and logging to the app to get a better picture of what's going on.

Tor Win32 Service doesn't start

I raised a ticket at the Tor project about this and got the following response:

Tor we ship in Tor Browser is not to be meant to be a standalone Tor.
If you want to have a standalone Tor on Windows please use the expert
bundle
https://www.torproject.org/dist/torbrowser/7.0.11/tor-win32-0.3.1.9.zip

So I took the advice and downloaded the recommended package and the tor.exe in that package works perfectly, both from the command line and as a service.

A.N.'s comment/question "is it the correct Tor executable?" was right on the money, though I didn't read that until after I had solved the problem. And until then I wouldn't have known how to answer it. ("Is it the correct executable? How would I know? How is one supposed to tell? The one I have won't even tell me what version it is.")

It is a puzzle to me that the Tor Browser bundle contains a program called tor.exe, and installs it as a service, when the file is not meant to be a program you can actually run. I do realize that .exe files are not always really executable, and can be simply repositories of binary resources. But you don't install such files as services. Having two files called tor.exe, one which is meant to be executed and the other not, does strike me as unnecessarily obscure.



Related Topics



Leave a reply



Submit