ServiceInstaller.Description Propiedad

Definición

Obtiene o establece la descripción del servicio.

public:
 property System::String ^ Description { System::String ^ get(); void set(System::String ^ value); };
[System.Runtime.InteropServices.ComVisible(false)]
[System.ServiceProcess.ServiceProcessDescription("ServiceInstallerDescription")]
public string Description { get; set; }
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.ServiceProcess.ServiceProcessDescription("ServiceInstallerDescription")>]
member this.Description : string with get, set
Public Property Description As String

Valor de propiedad

String

La descripción del servicio. El valor predeterminado es una cadena vacía ("").

Atributos

Ejemplos

En el ejemplo de código siguiente se establecen las propiedades de instalación de una nueva aplicación de servicio de Windows. En el ejemplo se establece el nombre del servicio, junto con el nombre para mostrar y la descripción. Después de asignar las propiedades de instalación para el servicio, el ejemplo agrega el ServiceInstaller objeto a la Installers colección.

simpleServiceProcessInstaller = new ServiceProcessInstaller();
simpleServiceInstaller = new ServiceInstaller();

// Set the account properties for the service process.
simpleServiceProcessInstaller.Account = ServiceAccount.LocalService;

// Set the installation properties for the service.
// The ServiceInstaller.ServiceName must match the
// ServiceBase.ServiceName set in the service
// implementation that is installed by this installer.
simpleServiceInstaller.ServiceName = "SimpleService";

simpleServiceInstaller.DisplayName = "Simple Service";
simpleServiceInstaller.Description = "A simple service that runs on the local computer.";
simpleServiceInstaller.StartType = ServiceStartMode.Manual;

// Add the installers to the Installer collection.
Installers.Add(simpleServiceInstaller);
Installers.Add(simpleServiceProcessInstaller);
' Start the service.
Protected Overrides Sub OnStart(ByVal args() As String) 
    ' Start a separate thread that does the actual work.
    If workerThread Is Nothing OrElse(workerThread.ThreadState And System.Threading.ThreadState.Unstarted Or System.Threading.ThreadState.Stopped) <> 0 Then
        Trace.WriteLine(DateTime.Now.ToLongTimeString() + " - Starting the service worker thread.", "OnStart")
        
        workerThread = New Thread(New ThreadStart(AddressOf ServiceWorkerMethod))
        workerThread.Start()
    End If
    If Not (workerThread Is Nothing) Then
        Trace.WriteLine(DateTime.Now.ToLongTimeString() + " - Worker thread state = " + workerThread.ThreadState.ToString(), "OnStart")
    End If

End Sub

Comentarios

Utilice la Description propiedad para describir el propósito del servicio instalado al usuario. El usuario puede ver la descripción del servicio en las aplicaciones que muestran los detalles de los servicios instalados.

Por ejemplo, con Windows XP, puede ver la descripción del servicio con la utilidad de línea de comandos Service Control (Sc.exe) o puede ver la descripción del servicio en el nodo Servicios de la consola de administración de equipos.

Se aplica a

Consulte también