i am facing a scenario like, I started windows service and at some point, some database connectivity issues came (due to some network prob). Topshelf called the Start
method again while windows service was already running & it didn't call Stop
method before calling Start
again (i came to know of this thing by reading logs because i log some text in "Start" method)
I don't want Topshelf to call Start method multiple times. Any solution?
So Topshelf should only call your delegate for WhenStarted
when the Service Control Manager requests a start. If you see start being called more than once, is your service crashing and restarting? Are you running multiple instances of your service somehow? Are you sure it's the WhenStarted
delegate that's being called?