C
Charles A. Lackman
Hello,
I wrote a Windows Service is VB.NET and it works like clock work every
night. The problems is that the driver I am using to connect to a
datasource become inactive at a period of time. I destroy all it's
dependencies and recreate the connection every time the Windows Service
needs to retrieve the required data. In spite of my efforts to create a new
connection to the datasource, I continually receive a communication error on
or about the 3 or 4 day (the data is retrieved every night).
The only way I have been able to get the data to pull (after I receive the
communication error) is to restart the Windows Service.
Is there a way to make the Windows Service Restart itself?
i.e..
Try
AConnection.Open
ACommand.ExecuteNonQuery
AConnection.Close
AConnection.Dispose
Catch Err as Exception
WriteToLogFile(Err.ToString)
AConnection.Close
AConnection.Dispose
Me.Restart
End try
I Found Code To Stop The Service, but once it's stopped, then how would I
start it.
Dim scm As New ServiceController(Me.ServiceName)
scm.Stop()
Chuck
I wrote a Windows Service is VB.NET and it works like clock work every
night. The problems is that the driver I am using to connect to a
datasource become inactive at a period of time. I destroy all it's
dependencies and recreate the connection every time the Windows Service
needs to retrieve the required data. In spite of my efforts to create a new
connection to the datasource, I continually receive a communication error on
or about the 3 or 4 day (the data is retrieved every night).
The only way I have been able to get the data to pull (after I receive the
communication error) is to restart the Windows Service.
Is there a way to make the Windows Service Restart itself?
i.e..
Try
AConnection.Open
ACommand.ExecuteNonQuery
AConnection.Close
AConnection.Dispose
Catch Err as Exception
WriteToLogFile(Err.ToString)
AConnection.Close
AConnection.Dispose
Me.Restart
End try
I Found Code To Stop The Service, but once it's stopped, then how would I
start it.
Dim scm As New ServiceController(Me.ServiceName)
scm.Stop()
Chuck