I've build a vb.net windows service which does nothing but ping a wcf webservice and handles sending a maintenance request to this same webservice at night time. It does both tasks using a timer event. If the service does nothing but these two things it says at startup that it's shutting down cause of being idle. The windows service thread needs something todo.
What is the best way to prevent this shutdown without wasting the machines resources? Or did I miss some setting on the api to disable the idle check?
Protected Overrides Sub OnStart(ByVal args() As String)
Dim keepAliveTimer As New System.Timers.Timer(3600000)
AddHandler keepAliveTimer.Elapsed, AddressOf IsWebserviceAliveHandler
keepAliveTimer.AutoReset = True
keepAliveTimer.Start()
Dim interval As Integer = Me.CalculateInterval(8, 25)
Dim timer As New System.Timers.Timer(interval)
AddHandler timer.Elapsed, AddressOf SendDailyMaintenanceRequestHandler
timer.AutoReset = True
timer.Start()
End Sub