ServiceInstaller.ServiceName Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Indica el nombre usado por el sistema para identificar este servicio. Esta propiedad debe ser idéntica al ServiceName del servicio que desea instalar.
public:
property System::String ^ ServiceName { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string ServiceName { get; set; }
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ServiceProcess.ServiceProcessDescription("ServiceInstallerServiceName")]
public string ServiceName { get; set; }
[System.ServiceProcess.ServiceProcessDescription("ServiceInstallerServiceName")]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string ServiceName { get; set; }
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.ServiceName : string with get, set
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
[<System.ServiceProcess.ServiceProcessDescription("ServiceInstallerServiceName")>]
member this.ServiceName : string with get, set
[<System.ServiceProcess.ServiceProcessDescription("ServiceInstallerServiceName")>]
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.ServiceName : string with get, set
Public Property ServiceName As String
Valor de propiedad
Nombre del servicio que se va a instalar. Este valor debe establecerse antes de que la utilidad de instalación intente instalar el servicio.
- Atributos
Excepciones
La ServiceName propiedad no es válida.
Comentarios
Es fundamental que sea ServiceName idéntico al ServiceBase.ServiceName de la clase derivada de ServiceBase. Normalmente, el valor de la ServiceBase.ServiceName propiedad del servicio se establece dentro de la función Main() del ejecutable de la aplicación de servicio. Service Control Manager usa la ServiceInstaller.ServiceName propiedad para localizar el servicio dentro de este ejecutable.
Al establecer el ServiceName del instalador de servicio, el Source del registro de eventos asociado se establece en el mismo valor. Esto permite que el servicio registre automáticamente los comandos del servicio (como Iniciar y detener) a la aplicación inicia sesión en el equipo.
Nota:
Si ya existe un origen con el mismo nombre en el equipo, pero en un registro distinto del registro de aplicación, se producirá una excepción. Si el origen existe y está asociado al registro de aplicación, ese origen se usa para notificar las llamadas de comando al servicio y no se produce ninguna excepción.
no ServiceName puede ser null o tener una longitud cero. Su tamaño máximo es de 256 caracteres. Tampoco puede contener barras diagonales o inversas, '/' o '\', o caracteres del juego de caracteres ASCII con un valor inferior al valor decimal 32.