Declaration
public static void ExecuteAsService(
Action onStart,
Action onStop = null,
Action onShutdown = null,
Func<PowerBroadcastStatus, bool> onPowerEvent = null
)Summary
Passes control to the service manager, and configures callbacks to be used by the service manager in response
to various events. This method must be called when the process is invoked with command line arguments
specified in
SingleSelfService.Install(string, string, string, string, ServiceStartMode, ServiceAccount, string, string, IList<string>). Does not return (unless called outside of SCM control, in which case it
shows a generic error message and terminates the process).
Parameters
| Action | onStart |
Invoked when the service is started. |
| Action | onStop |
Invoked when the service is stopped. Optional. |
| Action | onShutdown |
Invoked when the system is shutting down. Optional. |
| Func<PowerBroadcastStatus, bool> | onPowerEvent |
Invoked on a power status change event. Optional. For more information, see ServiceBase.OnPowerEvent. |