
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