ServiceController.ServiceName Propiedad

Definición

Obtiene o establece el nombre que identifica el servicio al que hace referencia esta instancia.Gets or sets the name that identifies the service that this instance references.

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.The name that identifies the service that this ServiceController instance references. El valor predeterminado es una cadena vacía ("").The default is an empty string ("").

Atributos

Excepciones

El valor de ServiceName es null.The ServiceName is null.

La sintaxis de la propiedad ServiceName no es válida.The syntax of the ServiceName property is invalid.

No se encontró el servicio.The service was not found.

Comentarios

ServiceNameIdentifica el servicio para el administrador de control de servicios.The ServiceName identifies the service to the Service Control Manager. Si se cambia esta propiedad ServiceController , la instancia se enlaza a otro servicio, no cambia lo que muestra el complemento Microsoft Management Console del administrador de control de servicios.Changing this property causes the ServiceController instance to bind to another service, it does not change what the Service Control Manager's Microsoft Management Console snap-in displays.

Cuando se implementa un servicio personalizado, el valor de esta propiedad debe ser idéntico al nombre registrado para el servicio en la ServiceName propiedad de la ServiceInstaller clase correspondiente.When you are implementing a custom service, the value of this property must be identical to the name recorded for the service in the ServiceName property of the corresponding ServiceInstaller class. En el código, ServiceName normalmente se establece en la main() función del ejecutable.In code, the ServiceName is usually set in the main() function of the executable.

Al restablecer la ServiceName propiedad, el método que establece la propiedad establece el valor de esta instancia DisplayName en una cadena vacía ("").When you reset the ServiceName property, the method that sets the property sets this instance's DisplayName to an empty string ("").

Se aplica a