T
Terry Olsen
I'm trying to shutdown my service by stopping all the started classes &
threads.
In each Class I have a Public Sub like this:
Public Sub StopIntf()
Try
Threading.Thread.CurrentThread.Abort()
Catch
End Try
End Sub
In my OnStop routine, I have this:
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
EmailProcessor.StopEmailProcessor()
SmtpSvr.StopServer()
NntpClt.StopNntpClient()
BbsIntf.StopIntf()
End Sub
But when I try to stop my service, I get a message that says the service did
not stop and did not return an error. I look in the Event Log and I get
this:
Description:
Failed to stop service. System.Threading.ThreadAbortException: Thread was
being aborted.
at BoycoTMailNews.BoycoTMailNews.OnStop()
at System.ServiceProcess.ServiceBase.DeferredStop()
How to you properly stop a service that has spawned several threads?
threads.
In each Class I have a Public Sub like this:
Public Sub StopIntf()
Try
Threading.Thread.CurrentThread.Abort()
Catch
End Try
End Sub
In my OnStop routine, I have this:
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
EmailProcessor.StopEmailProcessor()
SmtpSvr.StopServer()
NntpClt.StopNntpClient()
BbsIntf.StopIntf()
End Sub
But when I try to stop my service, I get a message that says the service did
not stop and did not return an error. I look in the Event Log and I get
this:
Description:
Failed to stop service. System.Threading.ThreadAbortException: Thread was
being aborted.
at BoycoTMailNews.BoycoTMailNews.OnStop()
at System.ServiceProcess.ServiceBase.DeferredStop()
How to you properly stop a service that has spawned several threads?