【问题标题】:Azure is ignoring Scheduling settings for WebJobAzure 正在忽略 WebJob 的计划设置
【发布时间】:2016-04-05 15:09:43
【问题描述】:

我使用 Visual Studio 以建议的方式部署了 WebJob,右键单击控制台项目,选择“发布为 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"
}

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

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

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

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

【问题讨论】:

  • 建议的方法是使用 CRON 表达式 (azure.microsoft.com/en-us/documentation/articles/…)。您的问题同时询问两者,因此可能会在两者之间造成混淆(这确实是问题)。如果您无法让 CRON 表达式正常工作,我建议您提出一个专门针对该问题的问题。
  • 我添加了第二个(settings.job)只是因为第一种方法不起作用,希望它可能起作用。
  • 明白,但这最终会问两个问题,因为它们的工作方式大不相同。
  • 我通过使用 contious webjob 和使用 Threading.Timer 解决了这个问题。更多的是破解而不是解决方案。
  • webjob stackoverflow.com/questions/36218203/…有一个timertrigger

标签: azure azure-webjobs


【解决方案1】:

使用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"
    }

完成。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多