/// <summary> /// Constructor /// </summary> /// <param name="serviceIdentity">Service's identity information</param> /// <param name="serviceStartMode">Service start mode</param> /// <param name="serviceAccount">Service account</param> public StandaloneServiceInstaller(StandaloneServiceIdentity serviceIdentity, ServiceStartMode serviceStartMode = ServiceStartMode.Automatic, ServiceAccount serviceAccount = ServiceAccount.LocalSystem) { var processInstaller = new ServiceProcessInstaller(); var serviceInstaller = new ServiceInstaller(); // Set the privileges serviceInstaller.DisplayName = serviceIdentity.Name; serviceInstaller.StartType = serviceStartMode; processInstaller.Account = serviceAccount; // Must be the same as what was set in Program's constructor serviceInstaller.ServiceName = serviceIdentity.Id; this.Installers.Add(processInstaller); this.Installers.Add(serviceInstaller); }
/// <summary> /// Constructor /// </summary> /// <param name="identity">Identity information</param> public StandaloneService(StandaloneServiceIdentity serviceIdentity) { // Set identity this.serviceIdentity = serviceIdentity; }