Azure忽略了WebJob的计划设置

时间:2016-04-05 15:09:43

标签: azure azure-webjobs

我使用Visual Studio以建议的方式部署WebJob,右键单击控制台项目,选择“Publish as Azure Webjob”并浏览设置。 我选择了一个计划的计划,导致在Properties-Folder中创建文件“webjob-publish-settings.json”,其中包含以下内容:

{
  "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
  "webJobName": "TestCredentials2",
  "startTime": "2016-04-05T01:00:00+01:00",
  "endTime": "2016-04-12T00:00:00+01:00",
  "jobRecurrenceFrequency": "Minute",
  "interval": 3,
  "runMode": "Scheduled"
}

部署工作时,webjob处于“按需”状态。当我从Azure门户手动启动Webjob时,Webjob运行一次,但不会自动重启。

我还尝试在项目的根目录中添加“settings.job”(设置为“如果更新则复制”):

{ "schedule": "0 /5 * * * *"}

行为仍然没有区别,但也没有错误信息。

1 个答案:

答案 0 :(得分:16)

使用settings.job方法确实有效。必须完成以下事项:

1. Create a settings.job with the content in the question
2. select Build Action "Content" for that file
3. Select "Copy if newer"
4. Delete the generated "Properties/webjob-publish-actions.json"
5. Re-Publish the Project, chose "On Demand" instead of a schedule plan 

这会创建一个新的webjob-publish-actions.json:

{
      "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
      "webJobName": "MyTimer",
      "startTime": null,
      "endTime": null,
      "jobRecurrenceFrequency": null,
      "interval": null,
      "runMode": "OnDemand"
    }

完成。