1
Answer

Task Factory Method with Delay

Ragunath V

Ragunath V

9y
564
1
Hi,
 
am trying to call a particular Method with 5 mins Delay.below is my code.
 
try
{
HttpContext ctx = HttpContext.Current;
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
HttpContext.Current = ctx;
System.Threading.Thread.Sleep(5 * 60 * 1000);
Sendafter5mins(param1,params2);
});
}
catch (Exception EX){
//Log Exception if any  
}
 
This Method is failing silently sometimes without any exception in log.
 
Please Suggest me is this the right way to fire a method with 5 mins delay. 
 

Answers (1)