如何编写azure web角色-工作者角色计划任务?

发布于 2025-01-04 08:25:39 字数 184 浏览 5 评论 0原文

我在我的天蓝色项目中遇到了冲突, 我正在尝试隔离任务: 每个月 16 日,从个人网站生成 .xml 文件。

在我的项目中,我有一个网络角色和一个工作者角色, 我尝试在每月 16 号隔离 Web 角色将创建一条消息(连接到站点并下载 .xml 文件),将其插入队列存储,辅助角色获取消息处理它并删除消息。

有人建议吗??

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??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

独夜无伴 2025-01-11 08:25:39

您看过这篇文章吗 - http:// blog.smarx.com/posts/building-a-task-scheduler-in-windows-azure?它讨论了一种构建任务调度程序的方法,这看起来非常像您想要做的事情。

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.

谷夏 2025-01-11 08:25:39

在您的辅助角色中,您可以启动 计时器 或使用:http://quartznet.sourceforge.net/< /a>

In your worker role you can start a timer or use this: http://quartznet.sourceforge.net/

盛夏已如深秋| 2025-01-11 08:25:39

Azure Web 角色是一个 Windows 服务器,因此具有内置的任务计划程序,就像任何其他 Windows 服务器一样。您可以使用启动任务将计划任务添加到 Web 或辅助角色上的任务计划程序,然后该任务将在每月 16 日触发。

但是,请记住,如果您有多个 Web 角色/辅助角色,则每个角色都将设置此计划任务。因此,您需要通过某种方式了解另一个角色是否已处理该工作,或者计划任务将为每个 Web 角色运行一次。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文