ServiceController 생성자

정의

ServiceController 클래스의 새 인스턴스를 초기화합니다.

오버로드

Name Description
ServiceController()

특정 서비스와 연결되지 않은 클래스의 ServiceController 새 인스턴스를 초기화합니다.

ServiceController(String)

로컬 컴퓨터의 기존 서비스와 연결된 클래스의 ServiceController 새 인스턴스를 초기화합니다.

ServiceController(String, String)

지정된 컴퓨터에서 기존 서비스와 연결된 클래스의 ServiceController 새 인스턴스를 초기화합니다.

ServiceController()

Source:
ServiceController.cs
Source:
ServiceController.cs
Source:
ServiceController.cs
Source:
ServiceController.cs

특정 서비스와 연결되지 않은 클래스의 ServiceController 새 인스턴스를 초기화합니다.

public:
 ServiceController();
public ServiceController();
Public Sub New ()

적용 대상

ServiceController(String)

Source:
ServiceController.cs
Source:
ServiceController.cs
Source:
ServiceController.cs
Source:
ServiceController.cs

로컬 컴퓨터의 기존 서비스와 연결된 클래스의 ServiceController 새 인스턴스를 초기화합니다.

public:
 ServiceController(System::String ^ name);
public ServiceController(string name);
new System.ServiceProcess.ServiceController : string -> System.ServiceProcess.ServiceController
Public Sub New (name As String)

매개 변수

name
String

시스템에 대한 서비스를 식별하는 이름입니다. 서비스의 표시 이름일 수도 있습니다.

예외

name 가 잘못되었습니다.

예제

다음 예제에서는 생성자를 사용하여 ServiceController.ServiceController(String) 샘플 서비스를 제어하는 데 사용되는 개체를 만드는 ServiceController 방법을 보여 줍니다. 이 예제는 클래스에 대해 제공되는 더 큰 예제의 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())

적용 대상

ServiceController(String, String)

Source:
ServiceController.cs
Source:
ServiceController.cs
Source:
ServiceController.cs
Source:
ServiceController.cs

지정된 컴퓨터에서 기존 서비스와 연결된 클래스의 ServiceController 새 인스턴스를 초기화합니다.

public:
 ServiceController(System::String ^ name, System::String ^ machineName);
public ServiceController(string name, string machineName);
new System.ServiceProcess.ServiceController : string * string -> System.ServiceProcess.ServiceController
Public Sub New (name As String, machineName As String)

매개 변수

name
String

시스템에 대한 서비스를 식별하는 이름입니다. 서비스의 표시 이름일 수도 있습니다.

machineName
String

서비스가 있는 컴퓨터입니다.

예외

name 가 잘못되었습니다.

-또는-

machineName 가 잘못되었습니다.

설명

매개 변수의 machineName 경우 "."를 사용하여 로컬 컴퓨터를 나타낼 수 있습니다.

적용 대상