We have two scheduled jobs. One is scheduled to run at 7:00 AM the other at 7:30 AM. The first day they run at the times they were scheduled to run. After that they run at different times. For example; one job, scheduled for 7:00 AM ran at 9:15 AM and the next day at 4:40 PM.
We have IIS Application Initialization installed on the IIS Server. Can anyone explain why this is happening?
Thanks for your assistance.
how do you set scheduling time to execute specificly at 7:00 AM? how long it takes for the job to execute?
Scheduled tasks are set to run at an interval, e.g. one time every day. When the job has finished it updates "next run" with the interval. That means that if the job starts at 7:00 and ends at 7:02, next run will be sheduled at 7:02 the next day, next day after that 7:04, and so on.I think that sheduled jobs also depends on the site getting traffic. If there is no traffic, the scheduled job won't run at the scheduled time. But once there is traffic, scheduled jobs that are "late" will run (and after that the interval will be used to set next run).
"I think that sheduled jobs also depends on the site getting traffic" - can you show the code where this is decided?
Nope, but now I took a look in the docs :-)
Because scheduled jobs are executed in the same process as the site, the site's web server must be up and running. To ensure this, use the IIS feature "Application Initialization," or have a site supervisor periodically ping the site. In Azure Web Apps enable "Always On"
I interpret that to: either have traffic or use other means to stop site from going to sleep.