Condividi tramite


ServiceController.CanShutdown Proprietà

Definizione

Ottiene un valore che indica se il servizio deve ricevere una notifica quando il sistema viene arrestato.

public:
 property bool CanShutdown { bool get(); };
public bool CanShutdown { get; }
[System.ServiceProcess.ServiceProcessDescription("SPCanShutdown")]
public bool CanShutdown { get; }
member this.CanShutdown : bool
[<System.ServiceProcess.ServiceProcessDescription("SPCanShutdown")>]
member this.CanShutdown : bool
Public ReadOnly Property CanShutdown As Boolean

Valore della proprietà

true se il servizio deve ricevere una notifica quando il sistema viene arrestato; in caso contrario, false.

Attributi

Eccezioni

Si è verificato un errore durante l'accesso a un'API di sistema.

Il servizio non è stato trovato.

Esempio

Nell'esempio seguente viene illustrato l'uso della CanShutdown proprietà per determinare se un servizio fornisce un gestore per un evento di arresto. Questo esempio fa parte di un esempio più ampio fornito per la ServiceController classe .

// Display properties for the Simple Service sample
// from the ServiceBase example.
ServiceController sc = new ServiceController("Simple Service");
Console.WriteLine("Status = " + sc.Status);
Console.WriteLine("Can Pause and Continue = " + sc.CanPauseAndContinue);
Console.WriteLine("Can ShutDown = " + sc.CanShutdown);
Console.WriteLine("Can Stop = " + sc.CanStop);
' Display properties for the Simple Service sample 
' from the ServiceBase example
Dim sc As New ServiceController("Simple Service")
Console.WriteLine("Status = " + sc.Status.ToString())
Console.WriteLine("Can Pause and Continue = " + _
    sc.CanPauseAndContinue.ToString())
Console.WriteLine("Can ShutDown = " + sc.CanShutdown.ToString())
Console.WriteLine("Can Stop = " + sc.CanStop.ToString())

Si applica a