Imports System.ServiceProcess Public Class Main Inherits WindowsService Public Sub New() End Sub Shared Sub Main() ' If this from the Windows Service If Not Environment.UserInteractive Then Dim loWindowsService As ServiceBase() loWindowsService = New ServiceBase() {New WindowsService()} ServiceBase.Run(loWindowsService) Else oWindowsService = New WindowsService() oWindowsService.Start() Console.ReadLine() oWindowsService.Stop2() End If End Sub Public Overrides Function Initialize() As Boolean oApp.cMemberTable = "Member" Return True End FunctionAs you can see, I have an Overrrides on Initialize(). This does not get called anymore. It took me a while to find a weird situation and this was due to this. This main class inherits from WindowsService. But, because the Main() method is instantiating an instance of the WindowsService class on its own, this cancelled the default behavior of the WindowsService base class which contains something like this:
' Allow the client to set up custom code in the initialization Public Overridable Function Initialize() As Boolean Return True End FunctionFor this one, I have to say, I have no idea on how to rearchitect the design so it would be called. Have you ever done something like that?