Azure WebRole Scheduled Task Every Morning

谁说胖子不能爱 提交于 2019-12-06 09:13:54

问题


I am trying to figure out a solution to getting a WebRole to run a Task every morning at 5AM. I have looked at Quartz.Net and the examples on stackoverflow but all of them schedule the task to run every 10 minutes. Are there any examples that show how I can schedule it?


回答1:


Quartz.Net should be good for you.Try to use CronTrigger (or CronTriggerImpl in version 2.x).

Example of cron-expression - "0 0 5 * * ?" - run every day at 5 AM.

Cron trigger sub-expression position meaning:

  1. Seconds - 0 for you (run at 0 second)
  2. Minutes - 0 for you (run at 0 minutes)
  3. Hours - 5 for you (run at 5 hour; it uses 24-hour clock)
  4. Day-of-Month - * - run every day
  5. Month - * for you (run every month)
  6. Day-of-Week - ? - not specified for you (Day-of-Month has been used instead)
  7. Year (optional field) - not used



回答2:


You might also want to check out the Scheduler add-on in the Windows Azure Store (login to the portal at manage.windowsazure.com, head to Add-Ons, then hit App Services and select Scheduler).

Up to 5,000 scheduled jobs/month are free.



来源:https://stackoverflow.com/questions/14401878/azure-webrole-scheduled-task-every-morning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!