ServiceController.ServiceName Właściwość

Definicja

Pobiera lub ustawia nazwę, która identyfikuje usługę, do którego odwołuje się to wystąpienie.

public:
 property System::String ^ ServiceName { System::String ^ get(); void set(System::String ^ value); };
public:
 property System::String ^ ServiceName { System::String ^ get(); };
public string ServiceName { get; set; }
public string ServiceName { get; }
[System.ComponentModel.TypeConverter(typeof(System.ServiceProcess.Design.ServiceNameConverter))]
[System.ServiceProcess.ServiceProcessDescription("SPServiceName")]
public string ServiceName { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.ServiceProcess.Design.ServiceNameConverter))]
[System.ServiceProcess.ServiceProcessDescription("SPServiceName")]
[System.ComponentModel.SettingsBindable(true)]
public string ServiceName { get; set; }
member this.ServiceName : string with get, set
member this.ServiceName : string
[<System.ComponentModel.TypeConverter(typeof(System.ServiceProcess.Design.ServiceNameConverter))>]
[<System.ServiceProcess.ServiceProcessDescription("SPServiceName")>]
member this.ServiceName : string with get, set
[<System.ComponentModel.TypeConverter(typeof(System.ServiceProcess.Design.ServiceNameConverter))>]
[<System.ServiceProcess.ServiceProcessDescription("SPServiceName")>]
[<System.ComponentModel.SettingsBindable(true)>]
member this.ServiceName : string with get, set
Public Property ServiceName As String
Public ReadOnly Property ServiceName As String

Wartość właściwości

String

Nazwa, która identyfikuje usługę, do którego odwołuje się to ServiceController wystąpienie. Wartością domyślną jest ciąg pusty ("").

Atrybuty

Wyjątki

Składnia ServiceName właściwości jest nieprawidłowa.

Nie można odnaleźć usługi.

Uwagi

Element ServiceName identyfikuje usługę programu Service Control Manager. Zmiana tej właściwości powoduje ServiceController , że wystąpienie jest powiązane z inną usługą. Nie zmienia to, co jest wyświetlane przystawki Microsoft Management Console programu Service Control Manager.

Podczas implementowania usługi niestandardowej wartość tej właściwości musi być identyczna z nazwą zarejestrowaną dla usługi we ServiceName właściwości odpowiadającej mu ServiceInstaller klasy. W kodzie element ServiceName jest zwykle ustawiany w main() funkcji pliku wykonywalnego.

Po zresetowaniu ServiceName właściwości metoda ustawiana przez właściwość ustawia wartość tego wystąpienia DisplayName na pusty ciąg ("").

Dotyczy