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

独自空忆成欢 提交于 2019-12-30 03:09:31

问题


I scheduled a webjob to run daily at 2 am using cron expression (0 0 2 * * *) following tutorial from Create a scheduled WebJob using a CRON expression and my server is created in "north central US" region, so i hope it should run in US central timezone but seems it running at different time than what i specified.


回答1:


Based on the comments mentioned here, WebJobs run into the timezone configured for the WebApp where your WebJob is hosted. From this post:

Assuming you have not configured anything for the timezone, your cron job should use UTC which is the default timezone in Azure.

From Changing the server time zone on Azure Web Apps, you can specify the time zone you want your application to run in by making an application setting called WEBSITE_TIME_ZONE and set it to a proper value. From this blog 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”).



来源:https://stackoverflow.com/questions/37856122/microsoft-azure-webjob-in-which-timezone-a-webjob-runs-if-i-schedule-a-webjob-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!