I have a windows service that has been running. I have created a new version of the application. I went to the windows server and stopped the service. I then copied in the new .exe for the service and tried to start the service. The service won’t start, it times out trying to start and I can’t figure out why. I am positive that I have done this before. Do I need to uninstall the service and reinstall it?
Server: Windows Server 2003 R2
Application .NET Version: 2.0
Developed With: VS 2005
Language VB.NET
OnStart Method:
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Me.Timer1.Enabled = True
End Sub
InitializeComponent:
CHECKDB_INTERVAL_TIME = 10
Private Sub InitializeComponent()
Dim iWaitTime As Int16
iWaitTime = CType(ConfigurationManager.AppSettings("CHECKDB_INTERVAL_TIME"), Int16)
Me.components = New System.ComponentModel.Container
Me.Timer1 = New System.Timers.Timer()
Me.Timer1.Interval = iWaitTime * 60000
'
'HarleyCloser
'
Me.ServiceName = "MyService"
End Sub
Friend WithEvents Timer1 As System.Timers.Timer
I found the issue. The problem was with a directive that was being used to do something different in Debug mode versus Release mode.
I found the Issue. There was some code hidden in the service with a Debug Directive. If the service was compiled in Debug then it ran like a console application, if it was compiled in Release, then it ran as a service. So the Service was timing out on the OnStart because it was trying to run the whole console application.