Partager via


ServiceController.CanShutdown Propriété

Définition

Obtient une valeur indiquant si le service doit être averti lorsque le système s’arrête.

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

Valeur de propriété

true si le service doit être averti lorsque le système s’arrête ; sinon, false.

Attributs

Exceptions

Une erreur s’est produite lors de l’accès à une API système.

Le service n’a pas été trouvé.

Exemples

L’exemple suivant illustre l’utilisation de la CanShutdown propriété pour déterminer si un service fournit un gestionnaire pour un événement d’arrêt. Cet exemple fait partie d’un exemple plus large fourni pour 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())

S’applique à