protected override void OnStart(string[] args)
{
timer();
}
public void Timer_Elap(object source, ElapsedEventArgs e)
{
//Insert Into DataBase
}
protected override void OnStop()
{
}
protected void timer()
{
aTimer = null;
aTimer = new System.Timers.Timer();
aTimer = new Timer(10000);
aTimer.Elapsed += new ElapsedEventHandler(this.Timer_Elap);
aTimer.Interval = 5000;
aTimer.AutoReset = true;
aTimer.Enabled = true;
}
Context : I have used the above code to do the Insert process for every 5 seconds.But After 30 min the timer stop firings the insert method. And then, After 30 mins the timer restart automatically once again. How to reduce the timer start/stop timing and need to run the timer for 24 hours for every 5 seconds without any start/stop of the timer
Means: the values getting inserted for every 5 seconds up-to 30 min and stops inserting,then after 30 min of gap it starts inserting again automatically.. i don't want that 30 min gap