Microsoft Azure,Webjob,如果我使用 cron 表达式在指定时间每天将 webjob 安排到 运行,则 webjob 运行 的时区

Microsoft Azure,Webjob, in which timezone a webjob runs if I schedule a webjob to run daily at specified time using cron expression

我按照 Create a scheduled WebJob using a CRON expression 中的教程使用 cron 表达式 (0 0 2 * * *) 将网络作业安排在每天凌晨 2 点 运行 我的服务器是在 "north central US" 区域创建的,所以我希望它应该 运行 在美国中部时区,但它似乎 运行 与我指定的时间不同。

根据提到的评论 here,WebJobs 运行 进入为托管 WebJob 的 WebApp 配置的时区。从这个 post:

假设您没有为时区配置任何内容,您的 cron 作业应该使用 UTC,这是 Azure 中的默认时区。

Changing the server time zone on Azure Web Apps 起,您可以指定希望应用程序在 运行 中使用的时区,方法是进行名为 WEBSITE_TIME_ZONE 的应用程序设置并将其设置为适当的值。从这个博客 post:

If your app is hosted as a Web App on the Azure App Service (formerly known as Azure Websites), until recently you were completely out of luck. However there is now an easy and supported way to change the time zone for your w3wp process (and any processes it spawns):

All you need to do is add an Application Setting (via the portal or the management APIs) called WEBSITE_TIME_ZONE and set that to the name of the time zone as defined in the Windows Registry under HKLM\Software\Microsoft\Windows Nt\CurrentVersion\Time Zones\ (for example, “AUS Eastern Standard Time”).

根据 MS 文档,默认时区是 GMT

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=csharp#ncrontab-time-zones