ServiceInstaller.Description Proprietà

Definizione

Ottiene o imposta la descrizione del servizio.

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

Valore della proprietà

String

Descrizione del servizio. Il valore predefinito è una stringa vuota ("").

Attributi

Esempio

Nell'esempio di codice seguente vengono impostate le proprietà di installazione per una nuova Windows servizio. Nell'esempio viene impostato il nome del servizio, insieme al nome visualizzato e alla descrizione. Dopo aver assegnato le proprietà di installazione per il servizio, nell'esempio viene aggiunto ServiceInstaller l'oggetto alla Installers raccolta .

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

Commenti

Usare la Description proprietà per descrivere all'utente lo scopo del servizio installato. L'utente può visualizzare la descrizione del servizio nelle applicazioni che visualizzano i dettagli per i servizi installati.

Ad esempio, usando Windows XP, è possibile visualizzare la descrizione del servizio con l'utilità della riga di comando controllo dei servizi (Sc.exe) oppure è possibile visualizzare la descrizione del servizio all'interno del nodo Servizi della console Gestione computer.

Si applica a

Vedi anche