ServiceController コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ServiceController クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| ServiceController() |
特定のサービスに関連付けられていない ServiceController クラスの新しいインスタンスを初期化します。 |
| ServiceController(String) |
ローカル コンピューター上の既存のサービスに関連付けられている ServiceController クラスの新しいインスタンスを初期化します。 |
| ServiceController(String, String) |
指定したコンピューター上の既存のサービスに関連付けられている ServiceController クラスの新しいインスタンスを初期化します。 |
ServiceController()
特定のサービスに関連付けられていない ServiceController クラスの新しいインスタンスを初期化します。
public:
ServiceController();
public ServiceController();
Public Sub New ()
適用対象
ServiceController(String)
ローカル コンピューター上の既存のサービスに関連付けられている 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)
指定したコンピューター上の既存のサービスに関連付けられている 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
サービスが存在するコンピューター。
例外
注釈
machineName パラメーターでは、"." を使用してローカル コンピューターを表すことができます。