ServiceProcessInstaller.Account 属性

定义

获取或设置运行该服务应用程序时所使用的帐户类型。Gets or sets the type of account under which to run this service application.

public:
 property System::ServiceProcess::ServiceAccount Account { System::ServiceProcess::ServiceAccount get(); void set(System::ServiceProcess::ServiceAccount value); };
[System.ServiceProcess.ServiceProcessDescription("ServiceProcessInstallerAccount")]
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.

适用于

另请参阅