在Azure App Service中使用WebJobs运行后台任务 [英] Run Background tasks with WebJobs in Azure App Service

查看:75
本文介绍了在Azure App Service中使用WebJobs运行后台任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi团队,

在Azure选择进行负载平衡的单个实例上运行 - 请您澄清一下它是否 连续    触发
网络作业类型。根据我的理解,它是连续类型,因为它用于负载平衡(应始终可用) 

Runs on a single instance that Azure selects for load balancing - Could you please clarify me whether it is continuous and triggered web job type. As per my understanding it is continuous type because it is for load balancing(Should be always available) 

推荐答案


如果您的Azure网站站点在多个实例上运行,并且您创建了一个新的连续 WebJob,则WebJob将默认情况下在所有实例上运行。 (请注意,触发的WebJob将仅在随机选择的一个实例上运行。)
您可能希望连续的WebJob仅在一个实例上运行。您可以通过创建名为  settings.job 的文件并向其中添加以下内容来执行此操作:

If your Azure Web Sites site is running on multiple instances and you create a new continuous WebJob, the WebJob will run on all instances by default. (Note that a triggered WebJob will run on just one instance selected at random.) You may want your continuous WebJob to run on only one instance. You can do so by creating a file called settings.job and adding the following to it:

{ "is_singleton": true } 



添加此行后,将settings.job文件保存到连续WebJob的根文件夹中。

After you’ve added this line, save the settings.job file into the root folder for the continuous WebJob.


或者,您可以使用WebJobs API执行相同操作。有关此内容的更多信息,请参阅  GitHub


这篇关于在Azure App Service中使用WebJobs运行后台任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆