Azure 计时器功能不是 运行
Azure Timer Function not Running
我有一个带有计时器触发器的 Azure 函数。时间表是“0 0 18 * * MON-FRI”。我可以手动 运行 它,但它不会自动触发。我看到一些答案说 App Service Plan 不能是 "classic",但我没有看到该选项。我的函数应用程序的应用程序服务计划是基于消费的。有什么建议吗?
这里是function.json:
{
"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.24",
"configurationSource": "attributes",
"bindings": [
{
"type": "timerTrigger",
"schedule": "0 0 18 * * MON-FRI",
"useMonitor": true,
"runOnStartup": false,
"name": "myTimer"
}
],
"disabled": false,
"scriptFile": "../bin/MyApp.dll",
"entryPoint": "MyApp.ProcessOptions.Run"
}
如果它在 App Service Plan
中,您需要确保 Always On 已启用。
在Consumption
模式下,没有Always On
这样的东西。相反,您的函数应用程序应该 在计时器到期时自动唤醒 。为此,您的触发器需要 synced
,这通常会在各种情况下自动发生:
a) 如果您使用门户来更改功能
b) 如果您使用 msdeploy、Kudu git 部署或 Kudu 的 zipdeploy (/api/zipdeploy
)
部署函数应用程序
c) 如果您在门户中单击函数应用程序名称旁边的刷新小图标
注意:默认情况下,时间表使用 UTC 时间,因此在设置每日时间表时请注意这一点(它不会如果它每小时触发一次也没关系)。
您可以通过设置 WEBSITE_TIME_ZONE
将此更改为我们特定的时区。有关详细信息,请参阅 here。
更多细节,你可以参考这篇article。
我有一个带有计时器触发器的 Azure 函数。时间表是“0 0 18 * * MON-FRI”。我可以手动 运行 它,但它不会自动触发。我看到一些答案说 App Service Plan 不能是 "classic",但我没有看到该选项。我的函数应用程序的应用程序服务计划是基于消费的。有什么建议吗?
这里是function.json:
{
"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.24",
"configurationSource": "attributes",
"bindings": [
{
"type": "timerTrigger",
"schedule": "0 0 18 * * MON-FRI",
"useMonitor": true,
"runOnStartup": false,
"name": "myTimer"
}
],
"disabled": false,
"scriptFile": "../bin/MyApp.dll",
"entryPoint": "MyApp.ProcessOptions.Run"
}
如果它在 App Service Plan
中,您需要确保 Always On 已启用。
在Consumption
模式下,没有Always On
这样的东西。相反,您的函数应用程序应该 在计时器到期时自动唤醒 。为此,您的触发器需要 synced
,这通常会在各种情况下自动发生:
a) 如果您使用门户来更改功能
b) 如果您使用 msdeploy、Kudu git 部署或 Kudu 的 zipdeploy (/api/zipdeploy
)
c) 如果您在门户中单击函数应用程序名称旁边的刷新小图标
注意:默认情况下,时间表使用 UTC 时间,因此在设置每日时间表时请注意这一点(它不会如果它每小时触发一次也没关系)。
您可以通过设置 WEBSITE_TIME_ZONE
将此更改为我们特定的时区。有关详细信息,请参阅 here。
更多细节,你可以参考这篇article。