On 6 Mar, 12:19, Simon Harvey <notha...@hotmail.comwrote:
Hi all,
Can anybody tel me how to programatically kill my service when an
exception occurs?
Whenever something bad happens I'd like to shut it down.
Also, is there a way to programatically restart my service at a set
interval or when a particular condition is met within the application?
Many thanks
Simon
I do it this way:
ServiceController controller = new
ServiceController(ConfigSettings.QueueSettings.QCo nfig.ServiceName);
controller.Stop();
In this case I have the name of the service in my config as my
installer is designed to allow multiple installs on the same computer.
You can use the same controller instance to start services too.