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

查看:138
本文介绍了Microsoft Azure,Webjob,如果我计划使用cron表达式将Webjob安排在指定时间每天运行,则Webjob在哪个时区运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照

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.

推荐答案

基于提及的评论 here ,WebJob运行到为您的WebJob托管的WebApp配置的时区.从这篇文章:

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

假设您尚未为时区配置任何内容,则您的cron作业应使用UTC,这是Azure中的默认时区.

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

来自 Changing the server time zone on Azure Web Apps ,您可以通过进行名为WEBSITE_TIME_ZONE的应用程序设置并将其设置为适当的值来指定希望应用程序运行的时区.从这篇博客文章中:

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:

如果您的应用程序作为Web应用程序托管在Azure App Service上(以前 称为Azure网站),直到最近您完全没有了 运气.但是,现在有一种简单且受支持的方法可以更改 w3wp进程(及其产生的任何进程)的时区:

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):

您需要做的就是添加应用程序设置(通过门户或 管理API)称为WEBSITE_TIME_ZONE并将其设置为名称 Windows注册表下定义的时区 HKLM \ Software \ Microsoft \ Windows Nt \ CurrentVersion \ Time Zones \(用于 例如"AUS东部标准时间").

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").

这篇关于Microsoft Azure,Webjob,如果我计划使用cron表达式将Webjob安排在指定时间每天运行,则Webjob在哪个时区运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆