ServiceProcessInstaller.Account 屬性


Gets or sets the type of account under which to run this service application.Gets or sets the type of account under which to run this service application.

 property System::ServiceProcess::ServiceAccount Account { System::ServiceProcess::ServiceAccount get(); void set(System::ServiceProcess::ServiceAccount value); };
public System.ServiceProcess.ServiceAccount Account { get; set; }
member this.Account : System.ServiceProcess.ServiceAccount with get, set
Public Property Account As ServiceAccount


ServiceAccount , 定義系統用來執行此服務的帳戶類型。A ServiceAccount that defines the type of account under which the system runs this service. 預設為 UserThe default is User.



當屬性為User時, UsernamePassword屬性會用來定義服務應用程式執行時所使用的帳戶。 AccountWhen the Account property is User, the Username and Password properties are used to define an account under which the service application runs.

UsernamePassword配對允許服務在系統帳戶以外的帳戶下執行。The Username and Password pair allows the service to run under an account other than the system account. 例如, 這可以在沒有使用者登入時, 允許服務在重新開機時自動啟動。This can, for example, allow the service to start automatically at reboot, when no user is logged on. 如果您保留UsernamePassword空白, 並將設AccountUser, 則在安裝時, 系統會提示您輸入有效的使用者名稱和密碼。If you leave either the Username or Password empty and set Account to User, you will be prompted for a valid user name and password at installation.

您也可以指定以本機系統帳戶或本機或網路服務來執行服務。You can also specify that the service run under the local system account, or as a local or network service. 如需帳戶類型的詳細資訊, 請參閱列舉。ServiceAccountSee the ServiceAccount enumeration for details on types of accounts.