I have my worker role and I need to run a specific task exactly at 10 AM each day.
public class WorkerRole : RoleEntryPoint
{
public override void Run()
{
while (true)
{
if (DateTime.Now.Hour == 10)
{
//Do Specific timer Job();
}
//Do Normal Worker process();
Thread.Sleep(TimeSpan.FromMinutes(1));
}
}
This runs the timer job multiple times since I get only the hour, I cant just check it with a specific time say 10.00 since there is a chance that it might be skipped by the main worker process.
I need to know the ideal way to implement this.
I have seen this link and those mentioned in the answers,
How to Schedule a task in windows azure worker role
But I need a solution without using azure scheduler, or any third party tool :( Anyway by which I can use timers to check with the specific time ?