By now you’ve read my post on Three Tips For Debugging Windows Services. Of course, by “you” I mean Blossom. Well, here’s one tip that’s so obvious I’m embarrased that it took a week for me to find it out. Well, actually Steve found it.
Let’s say your windows service depends on an external resource. If that external resource isn’t available, it doesn’t make sense for the service to even run. You’ll want to log a message to the event log, and you may also want to fire off a WMI event for the friendly folks in operations. But how do you actually shut down your service?
Embarassingly simple, but I’m going to risk the inevitable “Well, duh!” comments so that no one else has to do all of the non-productive googling I did last week. All for you the reader…I’m a saint, I know.