How to make a Serviceapplication fail ?

I need windows to restart my service when it fails.
In the “Recovery” tab in “Windows Service Manager” I can set actions for my service when it fails.

The problem is how to tell windows that my service has terminated…

I have tried Quit(-1) in the UnhandledException event handler, but no luck.

Any Ideas ?
Not implemented is my guess…
Could it be done using declares ?

Got it working !

Had to also check [quote]“Enable actions for stops with errors”[/quote] and use Quit(2)