Azure功能-Cron触发器-每秒都可以,但不是每分钟

标签 azure cron azure-functions

我正在尝试在我的 Azure Function 计时器触发器中为每一分钟创建一个 CRON。

根据文档我发现了这个:https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer#cron-examples

“0 */1 * * * *” 根本不运行。

"*/1 * * * * *" 每秒运行一次。

我哪里出错了?

function.json 如下所示:

{
  "bindings": [
    {
      "name": "myTimer",
      "type": "timerTrigger",
      "direction": "in",
      "schedule": "0 */1 * * * *"
    }
  ],
  "scriptFile": "../dist/TriggerWork/index.js"
}

最佳答案

我可以通过 local.settings.json 中的 {AzureWebJobsStorage} 连接字符串条目重现您的问题,其格式在某种程度上不匹配: enter image description here

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "{AzureWebJobsStorage}",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

对于除 HTTP 之外的所有触发器,都需要有效的 AzureWebJobsStorage 连接字符串。其背后的原因与扩展到多个虚拟机有关:如果该功能扩展到多个虚拟机并具有多个实例,则需要一个存储帐户进行协调,以确保一次只有一个计时器触发器实例在运行。如果您尝试在本地进行开发,这会带来一些困难,但不幸的是,这目前是计时器触发器的限制。

更多详情,可以引用类似issue .

关于Azure功能-Cron触发器-每秒都可以,但不是每分钟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55719686/

相关文章:

postgresql - 超时已过期 : Connecting Azure Postgres using local pdAmin

android - 向目标设备发送推送通知

c# - JobHost 未检测到引用程序集中的 Azure HttpTriggers

c# - 将 Azure Function 发布为 NuGet 包(或从外部程序集加载函数)

Azure函数队列触发器: how to set time delay for dequeue message

azure - 有没有一种安全的方法可以根据 Web-API 100% 验证桌面应用程序的身份?

azure - 有没有办法阻止 Windows Azure 试用优惠中的计费?

azure - 如何设计ADF管道将一个容器数据拆分到cosmos数据库的多个容器中

linux - 从 crontab 运行 shell 脚本时权限被拒绝

linux - 跳过 cron 作业几个小时