gotnetdude
Active member
- Joined
- Jan 24, 2008
- Messages
- 27
- Programming Experience
- 10+
Service endings prematurely
I wrote a simple test windows service application (see code below) that makes a call to S2K DB through XSD. The problem I'm having is that when I start the service it successfully make the initial call to the database, but after that it does not iterate through the code on the 60 second intervals. If I remove the call to the S2K DB then it iterates through the code perfectly fine. I'm stumped. How do I fix this?
I wrote a simple test windows service application (see code below) that makes a call to S2K DB through XSD. The problem I'm having is that when I start the service it successfully make the initial call to the database, but after that it does not iterate through the code on the 60 second intervals. If I remove the call to the S2K DB then it iterates through the code perfectly fine. I'm stumped. How do I fix this?
VB.NET:
Public Class FanacSyncService
Protected Overrides Sub OnStart(ByVal args() As String)
Const iTimer_Interval As Integer = 60000
Dim oTimer As System.Threading.Timer
Dim tDelegate As Threading.TimerCallback = AddressOf FanacSync
oTimer = New System.Threading.Timer(tDelegate, Me, 0, iTimer_Interval)
End Sub
Public Sub FanacSync(ByVal sender As Object)
System.IO.File.AppendAllText("\\sn9218\fanacdatabase\test.txt", "step1")
Dim FanacProdLogDT As New FanacSync.ProdlogDataTable
Dim FanacProdLogAdapter As New FanacSyncTableAdapters.ProdlogTableAdapter
Dim FanacProdLogRecordCount As Integer
Dim MaxFanacSyncTransactionDateTime As Date = #1/1/2007#
FanacProdLogRecordCount = _
FanacProdLogAdapter.FillGetProdLogByStartSerial _
(FanacProdLogDT, MaxFanacSyncTransactionDateTime)
FanacProdLogDT.Dispose()
FanacProdLogAdapter.Dispose()
End Class
Last edited: