Hi, I'm sorry to ask this because I'm sure there is a simple explanation but I cannot find it anywhere. (And, obviously, I am new to TopShelf.)
I have a separate application that I am writing to monitor a service that uses TopShelf. After installing the service, I can connect to the service using ServiceController and get its status. However, I cannot Start or Stop the service using ServiceController. When the service is stopped and I try to start it using ServiceController.Start(), I get this exception message: "Cannot open <service name> service on computer '.' "
In the Program.cs of the service, the service is started using the same methodology as the sample code:
HostFactory.Run(x => //1
{
x.Service<TownCrier>(s => //2
{
s.ConstructUsing(name=> new TownCrier()); //3
s.WhenStarted(tc => tc.Start()); //4
s.WhenStopped(tc => tc.Stop()); //5
});
Is there something about this that needs to be changed in order for the ServiceController to be able to start/stop the service?
Thanks in advance,
Marcia