ServiceController.CanStop 속성

정의

시작한 서비스를 중지할 수 있는지의 여부를 나타내는 값을 가져옵니다.

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

속성 값

Boolean

서비스를 중지할 수 있고 OnStop() 메서드가 호출되면 true이고, 그렇지 않으면 false입니다.

특성

예외

시스템 API에 액세스할 때 오류가 발생했습니다.

서비스를 찾을 수 없습니다.

예제

다음 예제에서는 서비스가 중지 이벤트에 대한 처리기를 제공하는지 여부를 확인하기 위해 속성을 사용하는 CanStop 방법을 보여 줍니다. 이 예제는 클래스에 대해 제공되는 더 큰 예제의 ServiceController 일부입니다.

// 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())

적용 대상