S
Steven Thomas
I am writing an window service application in vb.net.
I have a sub that when called will start looping and doing work as
long as the service is running.
The problem I have is when I call the sub from the onstart sub the
service never thinks it has started. It remains in a "Starting"
state. Therefore I can not stop the service either.
All of the examples I can find just show turning on a timer that
writes to the event log, but no real examples of how to do some work
in the service.
Anyone know how to do this?
Thanks
/*--------------------- My code example ----------------*/
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.
StartService()
End Sub
Public Sub StartService()
Try
Dim IsRunning As Boolean = True
While IsRunning
' LOOP THROUGH THE WORK THE SERVICE IS PREFORMING
End While
Catch
' Handle errors
End Try
end sub
/*-------------------------------------------------------*/
I have a sub that when called will start looping and doing work as
long as the service is running.
The problem I have is when I call the sub from the onstart sub the
service never thinks it has started. It remains in a "Starting"
state. Therefore I can not stop the service either.
All of the examples I can find just show turning on a timer that
writes to the event log, but no real examples of how to do some work
in the service.
Anyone know how to do this?
Thanks
/*--------------------- My code example ----------------*/
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.
StartService()
End Sub
Public Sub StartService()
Try
Dim IsRunning As Boolean = True
While IsRunning
' LOOP THROUGH THE WORK THE SERVICE IS PREFORMING
End While
Catch
' Handle errors
End Try
end sub
/*-------------------------------------------------------*/