Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static method: void Install(string, string, string, string, ServiceStartMode, ServiceAccount, string, string, IList<string>)

Declaration

public static void Install(
    string name,
    string displayName,
    string description,
    string exeArgs,
    ServiceStartMode start = Automatic,
    ServiceAccount account = ServiceAccount.LocalService,
    string username = null,
    string password = null,
    IList<string> servicesDependedOn = null
)

Summary

Registers the running executable as an own-process Windows Service using the specified options. Throws a ServiceAlreadyExistsException if a service with the same name or display name already exists. Throws a Win32Exception for other errors.

Parameters

stringname Name of the service, used to uniquely identify it.
stringdisplayName Service name as it should be shown to the administrator.
stringdescription A description of the service, displayed in the sidebar in services.msc.
stringexeArgs Command-line arguments to be passed to the executable when started by the service manager as a service. When run with this command line, the executable must call SingleSelfService.ExecuteAsService(Action, Action, Action, Func<PowerBroadcastStatus, bool>) at some point during initialisation.
ServiceStartModestart Specifies whether the service should start automatically on boot.
ServiceAccountaccount Specifies one of the built-in accounts under which the service process should execute.
stringusername If using ServiceAccount.User, specifies the name of the user to run the service as.
stringpassword The password of the user account specified by username, if any.
IList<string>servicesDependedOn A list of service names that must be started before this service can be started, or null if none.