在 Azure 中交换部署槽时,Web 作业是否会重新启动?如果是这样,它们是否使用目标配置或源配置值重新启动?
就我而言,我不希望 Web 作业在暂存槽中运行。为了解决这个问题,我有以下代码:
public static void Main()
{
// Only run web jobs when configured
bool enableWebJobs = false;
bool.TryParse(ConfigurationManager.AppSettings["EnableWebJobs"], out enableWebJobs);
if (enableWebJobs)
{
var host = new JobHost();
host.RunAndBlock();
}
else
{
// Sleep so the Azure web jobs platform doesn't try to continually restart the process
while (true)
{
Thread.Sleep(60000);
}
}
}
我只是不确定在使用正确的 AppSettings 交换后是否会重新启动网络作业。如果没有,那么这根本不起作用,因为 EnableWebJobs 将保持为 false。