ServiceInstaller.StartType 屬性

定義

表示啟動此服務的方式和時間。Indicates how and when this service is started.

public:
 property System::ServiceProcess::ServiceStartMode StartType { System::ServiceProcess::ServiceStartMode get(); void set(System::ServiceProcess::ServiceStartMode value); };
[System.ServiceProcess.ServiceProcessDescription("ServiceInstallerStartType")]
public System.ServiceProcess.ServiceStartMode StartType { get; set; }
member this.StartType : System.ServiceProcess.ServiceStartMode with get, set
Public Property StartType As ServiceStartMode

屬性值

ServiceStartMode,表示服務啟動的方式。A ServiceStartMode that represents the way the service is started. 預設值為 Manual,其指定服務在重新開機後將不會自動啟動。The default is Manual, which specifies that the service will not automatically start after reboot.

屬性

例外狀況

啟動模式不是 ServiceStartMode 列舉的值。The start mode is not a value of the ServiceStartMode enumeration.

備註

設定, StartType以指定在重新開機後自動啟動服務, 或使用者必須手動啟動服務。Set the StartType to specify either that the service be started automatically after reboot or that a user must manually start the service. 服務也可以停用, 指定它無法以手動或程式設計方式啟動, 直到啟用為止。A service can also be disabled, specifying that it cannot be started, either manually or programmatically, until it is enabled.

您無法在ServiceInstaller安裝後變更屬性值。You cannot change ServiceInstaller property values after installation. 若要變更StartType, 您必須卸載並重新安裝您的服務, 或使用服務控制管理員手動變更設定。To change the StartType, you either have to uninstall and reinstall your service, or manually change the setting using the Service Control Manager.

適用於

另請參閱