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).
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.
- 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.
- 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.)
- 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
Launch an Application and Send It to Second Monitor
Posting Jsonobject With Httpclient from Web API
Kill Child Process When Parent Process Is Killed
How to Open the Default Chrome Profile Through Selenium, Chromedriver and Googlechrome
Choosing the Default Value of an Enum Type Without Having to Change Values
How to Print the Elements With Text Value That Contains in a List Selenium C#
How to Pass Jquery Variable Value to C# MVC
Disable Required Validation Attribute Under Certain Circumstances
Select Multiple Records Based on List of Id'S With Linq
Converting a CSV File to Json Using C#
Using Formflow Dialog in Bot Framework
C# How to Simply Encrypt a Text File With a Pgp Public Key
Select Distinct by Two Properties in a List
Could Not Parse the Json File ,Error in Progam.Cs ASP.NET Core
How to Create a 2D Array from a CSV File
Download File from an ASP.NET Web API Method Using Angularjs