restart service in case of exception
delphi, windows-services
Solution
Your service can programably configure recovery options for itself by calling the Win32 API `ChangeServiceConfig2()` function inside of its `AfterInstall` event. Set the `dwInfoLevel` to `SERVICE_CONFIG_FAILURE_ACTIONS` and set the `lpInfo` to point at a `SERVICE_FAILURE_ACTIONS` record describing what you want to happen when the service fails.
Problem
I'm developing service application that must restart itself. What are the ways of doing that? Is it possible to ask system start application again if it is stopped? I'm using Delphi 2007.