ServiceController.Pause Metoda
Definicja
Wstrzymuje operację usługi.Suspends a service's operation.
public:
void Pause();
public void Pause ();
member this.Pause : unit -> unit
Public Sub Pause ()
Wyjątki
Wystąpił błąd podczas uzyskiwania dostępu do interfejsu API systemu.An error occurred when accessing a system API.
Nie znaleziono usługi.The service was not found.
Przykłady
Poniższy przykład ilustruje użycie Pause metody w celu wstrzymania usługi.The following example demonstrates the use of the Pause method to pause a service. Ten przykład jest częścią większego przykładu dostarczonego dla ServiceController klasy.This example is part of a larger example that is provided for the ServiceController class.
sc.Pause();
while (sc.Status != ServiceControllerStatus.Paused)
{
Thread.Sleep(1000);
sc.Refresh();
}
Console.WriteLine("Status = " + sc.Status);
sc.Pause()
While sc.Status <> ServiceControllerStatus.Paused
Thread.Sleep(1000)
sc.Refresh()
End While
Console.WriteLine("Status = " + sc.Status.ToString())
Uwagi
Nie można wywołać Continue usługi do momentu, gdy kontroler usług nie ma stanu Paused
.You cannot call Continue for the service until the service controller status is Paused
.