ServiceController.ServiceName Propiedad

Definición

Obtiene o establece el nombre que identifica el servicio al que hace referencia esta instancia.

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

Valor de propiedad

String

Nombre que identifica el servicio al que hace referencia esta instancia de ServiceController. El valor predeterminado es una cadena vacía ("").

Atributos

Excepciones

El valor de ServiceName es null.

La sintaxis de la propiedad ServiceName no es válida.

No se encontró el servicio.

Comentarios

ServiceName identifica el servicio al Administrador de control de servicios. Al cambiar esta propiedad, la ServiceController instancia se enlaza a otro servicio, no cambia lo que muestra el complemento Microsoft Management Console de Service Control Manager.

Al implementar un servicio personalizado, el valor de esta propiedad debe ser idéntico al nombre registrado para el servicio en la ServiceName propiedad de la clase correspondiente ServiceInstaller . En el código, ServiceName normalmente se establece en la main() función del ejecutable.

Al restablecer la ServiceName propiedad , el método que establece la propiedad establece el valor de DisplayName esta instancia en una cadena vacía ("").

Se aplica a