G
Guest
I need to syc data from a local database with an external database on another
website once a day. I decided to try a timer contol and create an instance in
my global.asax. I call the function below in my Application_Start event.
For testing I set the timer interval to once every 3 minutes. My problem is
that the timer will work fine for about 20 to 25 minutes and then stop. When
I hit the website again the timer will start again and then stop.
Any suggestions would be most helpful.
Public Function StartSchedule() As String
Dim myTimer As New System.Timers.Timer
AddHandler myTimer.Elapsed, AddressOf MyScheduledOperation
myTimer.Interval = New TimeSpan(1, 0, 0, 0, 0).TotalMilliseconds
myTimer.Enabled = True
End Function
Public Sub MyScheduledOperation(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Do some stuff
End Sub
website once a day. I decided to try a timer contol and create an instance in
my global.asax. I call the function below in my Application_Start event.
For testing I set the timer interval to once every 3 minutes. My problem is
that the timer will work fine for about 20 to 25 minutes and then stop. When
I hit the website again the timer will start again and then stop.
Any suggestions would be most helpful.
Public Function StartSchedule() As String
Dim myTimer As New System.Timers.Timer
AddHandler myTimer.Elapsed, AddressOf MyScheduledOperation
myTimer.Interval = New TimeSpan(1, 0, 0, 0, 0).TotalMilliseconds
myTimer.Enabled = True
End Function
Public Sub MyScheduledOperation(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Do some stuff
End Sub