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
| string | name |
Name of the service, used to uniquely identify it. |
| string | displayName |
Service name as it should be shown to the administrator. |
| string | description |
A description of the service, displayed in the sidebar in services.msc. |
| string | exeArgs |
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. |
| ServiceStartMode | start |
Specifies whether the service should start automatically on boot. |
| ServiceAccount | account |
Specifies one of the built-in accounts under which the service process should execute. |
| string | username |
If using ServiceAccount.User, specifies the name of the user to run the service as. |
| string | password |
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. |