本文介绍了发布后如何防止Azure WebJob启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个带有登台"部署槽的Azure网站设置,并且我们使用连续的Azure WebJob来处理长期运行的后台作业.看来,当您发布到网站(并包括WebJob二进制文件)时,如果WebJob先前已停止,它将自动重新启动.

We have an Azure Website setup with a "staging" deployment slot, and we use a continuous Azure WebJob to process long-running background jobs. It appears that when you publish to the Website (and include the WebJob binaries), that the WebJob will restart itself if it was previously stopped.

我们当前的部署过程如下所示:

Our current deployment process looks like the following:

  1. 部署到STAGING
  2. 立即&快速停止WebJob标记(尝试阻止2个WebJob处理消息)
  3. 在STAGING上吸烟测试并验证代码
  4. 停止PRODUCTION WebJob(让它排出队列消息)
  5. 在生产和分级之间切换
  6. 启动PRODUCTION WebJob(这只是STAGING WebJob)
  1. Deploy to STAGING
  2. Immediately & Quickly stop the WebJob onSTAGING (try to prevent 2 WebJobs from processing messages)
  3. Smoke test and verify code on STAGING works
  4. Stop the PRODUCTION WebJob (let it drain off queue messages)
  5. Swap between PRODUCTION and STAGING
  6. Start the PRODUCTION WebJob (which was just the STAGING WebJob)

是否有一个技巧(例如标志文件之类)告诉WebJob发布后不启动?

Is there a trick (say a flag file or something) to tell a WebJob NOT to start up after publishing?

推荐答案

要在停止状态下部署连续的WebJob,只需在WebJob的根目录(二进制文件)中添加一个名为disable.job的文件,这将告诉框架WebJob当前已停止.

To deploy a continuous WebJob in a stopped state simply add a file called disable.job at the root of your WebJob (binaries), this will tell the framework that the WebJob is currently stopped.

要查看此行为,您可以简单地停止连续的WebJob,并查看此文件已生成并放置在WebJob的目录中.

To view this behavior you can simply stop a continuous WebJob and see that this file is generated and placed at the WebJob's directory.

这篇关于发布后如何防止Azure WebJob启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 01:49