问题描述
我们有一个带有登台"部署槽的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:
- 部署到STAGING
- 立即&快速停止WebJob标记(尝试阻止2个WebJob处理消息)
- 在STAGING上吸烟测试并验证代码
- 停止PRODUCTION WebJob(让它排出队列消息)
- 在生产和分级之间切换
- 启动PRODUCTION WebJob(这只是STAGING WebJob)
- Deploy to STAGING
- Immediately & Quickly stop the WebJob onSTAGING (try to prevent 2 WebJobs from processing messages)
- Smoke test and verify code on STAGING works
- Stop the PRODUCTION WebJob (let it drain off queue messages)
- Swap between PRODUCTION and STAGING
- 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启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!