${res:Templates.Project.WindowsService.Name}
VBNet
VBNet.Project.ServiceProject
VBNet
${res:Templates.Project.WindowsService.Description}
${ProjectName}
_
Private Sub InitializeComponents()
Me.ServiceName = "Service1"
End Sub
' This method starts the service.
_
Shared Sub Main()
' To run more than one service you have to add them to the array
System.ServiceProcess.ServiceBase.Run(New System.ServiceProcess.ServiceBase() { _
New MyService _
})
End Sub
' Clean up any resources being used.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
' TODO: Add cleanup code here (if required)
End Sub
Protected Overrides Sub OnStart(ByVal args() As String)
' TODO: Add start code here (if required)
' to start your service.
End Sub
Protected Overrides Sub OnStop()
' TODO: Add tear-down code here (if required)
' to stop your service.
End Sub
End Class
_
Public Class ProjectInstaller
Inherits Installer
Public Sub New()
Dim spi As ServiceProcessInstaller = New ServiceProcessInstaller
spi.Account = ServiceAccount.LocalSystem
Dim si As ServiceInstaller = New ServiceInstaller
si.ServiceName = "Hello Service Template"
si.StartType = ServiceStartMode.Automatic
Installers.AddRange(New Installer() {spi, si})
End Sub
End Class
]]>
' The assembly version has following format :
'
' Major.Minor.Build.Revision
'
' You can specify all values by your own or you can build default build and revision
' numbers with the '*' character (the default):
]]>