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); };
public System.ServiceProcess.ServiceAccount Account { get; set; }
[System.ServiceProcess.ServiceProcessDescription("ServiceProcessInstallerAccount")]
public System.ServiceProcess.ServiceAccount Account { get; set; }
member this.Account : System.ServiceProcess.ServiceAccount with get, set
[<System.ServiceProcess.ServiceProcessDescription("ServiceProcessInstallerAccount")>]
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. 默认值为 User。The default is User.
- 属性
注解
当 Account 属性为时 User , Username 和 Password 属性用于定义用于运行服务应用程序的帐户。When the Account property is User, the Username and Password properties are used to define an account under which the service application runs.
Username和 Password 对允许服务在除系统帐户之外的其他帐户下运行。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. 如果保留 Username 或 Password 为空,并且将设置 Account 为 User ,则在安装时系统将提示您输入有效的用户名和密码。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. ServiceAccount有关帐户类型的详细信息,请参阅枚举。See the ServiceAccount enumeration for details on types of accounts.