I have inherited a Windows service written in C#. Under rare conditions it fails badly. However, it isn\'t at all clear how to fail well. Ross Bennett states the problem e
After some testing I found the following works in cases where you calling Stop might cause other issues:
ExitCode = 1; Environment.Exit(1);
Just calling Environment.Exit doesn't make the SCM do fault handling, but first setting the ServiceBase ExitCode does.