how to write azure web role - worker role schedule task?

耗尽温柔 提交于 2019-12-24 02:55:13

问题


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

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