ServiceController Konstruktorok
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Inicializálja a ServiceController osztály új példányát.
Túlterhelések
| Name | Description |
|---|---|
| ServiceController() |
Inicializálja az ServiceController osztály egy új példányát, amely nincs hozzárendelve egy adott szolgáltatáshoz. |
| ServiceController(String) |
Inicializálja az ServiceController osztály új példányát, amely a helyi számítógépen lévő meglévő szolgáltatáshoz van társítva. |
| ServiceController(String, String) |
Inicializálja az ServiceController osztály új példányát, amely a megadott számítógépen lévő meglévő szolgáltatáshoz van társítva. |
ServiceController()
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
Inicializálja az ServiceController osztály egy új példányát, amely nincs hozzárendelve egy adott szolgáltatáshoz.
public:
ServiceController();
public ServiceController();
Public Sub New ()
A következőre érvényes:
ServiceController(String)
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
Inicializálja az ServiceController osztály új példányát, amely a helyi számítógépen lévő meglévő szolgáltatáshoz van társítva.
public:
ServiceController(System::String ^ name);
public ServiceController(string name);
new System.ServiceProcess.ServiceController : string -> System.ServiceProcess.ServiceController
Public Sub New (name As String)
Paraméterek
- name
- String
A rendszer szolgáltatását azonosító név. Ez lehet a szolgáltatás megjelenítendő neve is.
Kivételek
name érvénytelen.
Példák
Az alábbi példa bemutatja, hogy a ServiceController.ServiceController(String) konstruktor egy mintaszolgáltatás vezérlésére használt objektum létrehozásához ServiceController használható. Ez a példa egy nagyobb, az ServiceController osztályhoz tartozó példa része.
// 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())
A következőre érvényes:
ServiceController(String, String)
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
- Forrás:
- ServiceController.cs
Inicializálja az ServiceController osztály új példányát, amely a megadott számítógépen lévő meglévő szolgáltatáshoz van társítva.
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)
Paraméterek
- name
- String
A rendszer szolgáltatását azonosító név. Ez lehet a szolgáltatás megjelenítendő neve is.
- machineName
- String
A számítógép, amelyen a szolgáltatás található.
Kivételek
Megjegyzések
A paraméterhez használhatja a machineName "." parancsot a helyi számítógép ábrázolásához.