Service description for Windows Service 
Author Message
 Service description for Windows Service

I have created a Windows Service using VB.NET and I'm having trouble
figuring out how to set the description of the service as it should appear
in the Services panel under Computer Management.

The ProjectInstaller.vb source fragment as follows indicates where I am
setting the account under which the service will operate, and the service
name, but I cannot find a property of Service1Installer which would set the
service description.  Any help would be gratefully received!

Private Sub InitializeComponent()
    Me.ServiceProcessInstaller1 = New
System.ServiceProcess.ServiceProcessInstaller()
    Me.Service1Installer = New System.ServiceProcess.ServiceInstaller()
    'ServiceProcessInstaller1
    Me.ServiceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.LocalSystem
    Me.ServiceProcessInstaller1.Password = Nothing
    Me.ServiceProcessInstaller1.Username = Nothing
    'Service1Installer
    Me.Service1Installer.DisplayName = "Impaq xDE POP Mail Handler"
    Me.Service1HandlerInstaller.ServiceName = "Impaq xDE Mail Handler"
    Me.Service1Installer.<SHOULD BE A PROPERTY HERE SURELY?> = "Service
description"
    'ProjectInstaller
    Me.Installers.AddRange(New System.Configuration.Install.Installer()
{Me.ServiceProcessInstaller1, Me.xDEMailHandlerInstaller})
End Sub

Regards

Steve Griffiths
Solution Architecht
Impaq UK Limited



Mon, 11 Apr 2005 23:51:21 GMT  
 Service description for Windows Service
Hi Steve,

This is a known bug in the .NET Framework, so you have to set the service
description by hand. If you add the following override method to your
service's installer, it will set the service description properly.

Regards,

Mark

Imports Microsoft.Win32

<RunInstaller(True)> Public Class ProjectInstaller
    Inherits System.Configuration.Install.Installer

    'Wizard-generated installer code omitted for the sake of brevity

    Public Overrides Sub Install(ByVal stateSaver As
System.Collections.IDictionary)

        'First do the install
        MyBase.Install(stateSaver)

        Dim SK As RegistryKey, CCSK As RegistryKey
        Dim SSK As RegistryKey, DK As RegistryKey
        'Navigate to the correct registry key
        SK = Registry.LocalMachine.OpenSubKey("System")
        CCSK = SK.OpenSubKey("CurrentControlSet")
        SSK = CCSK.OpenSubKey("Services")
        DK = SSK.OpenSubKey(Me.ServiceInstaller1.ServiceName, True)

        'Now we can set the service description
        DK.SetValue("Description", "Allows remote service administration")

        'Cleanup
        DK.Close()
        SSK.Close()
        CCSK.Close()
        SK.Close()

    End Sub

End Class


I have created a Windows Service using VB.NET and I'm having trouble
figuring out how to set the description of the service as it should appear
in the Services panel under Computer Management.

The ProjectInstaller.vb source fragment as follows indicates where I am
setting the account under which the service will operate, and the service
name, but I cannot find a property of Service1Installer which would set the
service description.  Any help would be gratefully received!

Private Sub InitializeComponent()
    Me.ServiceProcessInstaller1 = New
System.ServiceProcess.ServiceProcessInstaller()
    Me.Service1Installer = New System.ServiceProcess.ServiceInstaller()
    'ServiceProcessInstaller1
    Me.ServiceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.LocalSystem
    Me.ServiceProcessInstaller1.Password = Nothing
    Me.ServiceProcessInstaller1.Username = Nothing
    'Service1Installer
    Me.Service1Installer.DisplayName = "Impaq xDE POP Mail Handler"
    Me.Service1HandlerInstaller.ServiceName = "Impaq xDE Mail Handler"
    Me.Service1Installer.<SHOULD BE A PROPERTY HERE SURELY?> = "Service
description"
    'ProjectInstaller
    Me.Installers.AddRange(New System.Configuration.Install.Installer()
{Me.ServiceProcessInstaller1, Me.xDEMailHandlerInstaller})
End Sub

Regards

Steve Griffiths
Solution Architecht
Impaq UK Limited



Thu, 14 Apr 2005 11:44:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Windows Service Description

2. Windows Service in VB.NET - Failed to process service command

3. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

4. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

5. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

6. Using WMI to obtain dependent services (restarting services and all dependent services)

7. Launch Windows form, from a Windows Service Application

8. installing web app with windows service and windows aplication at same time

9. Installing windows service in Windows 98,ME

10. Windows scripting host - Checking a service in Windows NT 4

11. Created and installed VB.Net service but don't see it in services

12. Please Help: Stopping a Service From Within The Service

 

 
Powered by phpBB® Forum Software