Question concerning Timer Control

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top