ServiceInstaller.Description Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define a descrição do serviço.
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 Propriedade
A descrição do serviço. O padrão é uma cadeia vazia ("").
- Atributos
Exemplos
O seguinte exemplo de código define as propriedades de instalação para uma nova aplicação de serviço Windows. O exemplo define o nome do serviço, juntamente com o nome de exibição e a descrição. Após atribuir as propriedades de instalação do serviço, o exemplo adiciona o ServiceInstaller objeto à Installers coleção.
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
Observações
Use a Description propriedade para descrever o propósito do serviço instalado ao utilizador. O utilizador pode visualizar a descrição do serviço em aplicações que mostram detalhes dos serviços instalados.
Por exemplo, usando Windows XP, pode visualizar a descrição do serviço com a utilidade de linha de comandos de Controlo de Serviço (Sc.exe) ou pode visualizar a descrição do serviço no nó Services da consola Gestão de Computadores.