问题
I am reaching a conflict in my azure project, I'm trying to seclude task : on every 16th of the month of .xml file form individual web site.
In my project I have one web role and one worker role, I trying to seclude on every 16th of the month that the web role will create a message(connect to the site and download the .xml file), insert it to the queue storage, the worker role gets the message process it and delete the message.
Suggestion anyone??
回答1:
Have you taken a look at this post - http://blog.smarx.com/posts/building-a-task-scheduler-in-windows-azure? It discusses one approach for building a task scheduler, which seems pretty much like what you're looking to do.
回答2:
In your worker role you can start a timer or use this: http://quartznet.sourceforge.net/
回答3:
An Azure web role is a windows server, and as such has a task scheduler built in, just like any other windows server. You can use a startup task to add a scheduled task to the task scheduler on a web or worker role which will then be fired on the 16th of every month.
However, keep in mind that if you have multiple web roles / worker roles, each one will have this scheduled task set up. So you'll need to have some way of knowing if another role has taken care of the work yet or not, or the scheduled task will run once for each web role.
来源:https://stackoverflow.com/questions/9193939/how-to-write-azure-web-role-worker-role-schedule-task