I have written a method to download some files from the internet(in my c#,mvc web project.). the same file should download each day between a specific time (because it updates).it works fine in the test environment. my problem is if the system is in live is it work properly the same way in test environment. just to show, this is the method
public void setupTimer(TimeSpan savingTime)
{
DateTime current = DateTime.Now;
TimeSpan timeTogo = savingTime - current.TimeOfDay;
if (timeTogo < TimeSpan.Zero)
{
return;
}
this.timer = new Timer(x =>
{
this.saveXmlFile();
}, null, timeTogo, InfiniteTimeSpan);
}