问题
To be clear there are no Errors for the hosted service, just a generic Windows service error.
The error message says:
Error 1053: The service did not respond to the start or control request in a timely fashion.
If I run NServiceBus.Host explicitly (where the windows service is installed) I am presented with relevant messages indicating a successful "spinning up" of the end point, and, in fact, I can see subscription message(s) are persisted into a relevant private MSMQ queue and the exe then sits and waits, like a good server should, for something to happen upon it.
If I start the windows service (hosting the endpoint) there are no exceptions or events in the event viewer, or entries in the log file to indicate any errors or give me reason to believe something bad is happening. If I look in the log file and queue I can see subscription messages are indicated as dispatched, in effect, the same behavior as running it standalone, with the only difference being that the service wont start.
EDIT: The windows service is provided by the NServiceBus framework in the form of a generic host, and therefore implementation of the various required windows service methods is not something I have control of, which you would normally have if you were creating the windows service yourself.
回答1:
The most common reason that I've found for this is down to logging.
The user account running the service must have Performance Monitoring Access.
I add this through Server Manager > Users & Groups > Groups > Performance Log Users > Add.
来源:https://stackoverflow.com/questions/23408585/why-does-a-windows-service-hosting-an-nservicebus-endpoint-in-nservicebus-host