コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="identity">Identity information</param>
 public StandaloneService(StandaloneServiceIdentity serviceIdentity)
 {
     // Set identity
     this.serviceIdentity = serviceIdentity;
 }