I have created a restful WCF service.Whenever client is calling this service method i have started a Timer with certain interval like below
var timer = new Timer();
timer.Interval = Convert.ToInt32(attempt);
timer.Tick += new EventHandler(timer_Tick);
var tempAttempt = new TempAttempt
{
AlertInformationId = currentAlertId,
Attempt = GetAttemptId(attempt),
Status = false,
TimerId = "Timer" + currentAlertId.ToString()
};
if (CreateNewAttempt(tempAttempt))
{
timer.Tag = tempAttempt.TimerId;
timer.Enabled = true;
timer.Start();
}
private void timer_Tick(object sender, EventArgs e)
{
//blah blah
Timer t = (Timer)sender;
}
After starting the timer the tick is not happened after that particular interval.How can i resolve this?
My Service
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/PushNotification")]
[OperationContract]
void PushNotification(MailInformation mailInformations);