Azure Webjobs 忽略 CRON 表达式
Azure Webjobs ignores CRON expression
我有一个程序,我想每天 运行 一次。我将 program.exe 和 settings.job 放在一个压缩文件中并上传。我坐着运行ning模式连续。我的 settings.job 看起来像:
{
"schedule": "0 0 8 * * *"
}
我的计划是每天 8 点 运行s,但 运行s 一直一遍又一遍地重复。
我做错了什么?
你的 webjob 运行 模式应该是 On Demand
:
来自文档:
- You still need Always On setting to be enabled on the app.
- Note: when deploying a WebJob from Visual Studio, make sure to mark your settings.job file properties as 'Copy if newer'.
经过数天尝试在 CRON 表达式上创建难以捉摸的 Azure WebJob 运行,但未成功,遵循顶级在线教程:
- https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/#CreateScheduledCRON
- http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/#.V5irdlcdpw8
- http://www.samulihaverinen.com/web-development/dotnet/2016/02/24/guide-to-azure-webjobs/
我终于设法 运行 在 cron 计划上完成了我的工作。
对我来说,根文件夹中的 settings.json 从来没有用过。确实有效并且实际上非常容易实现的是使用 Azure Webjobs SDK 扩展。
这种方法为您提供了实现调度的最大灵活性,它有很好的文档记录并且有完整的示例项目:https://github.com/Azure/azure-webjobs-sdk-extensions/blob/master/src/ExtensionsSample/Samples/TimerSamples.cs
有了这么简单的函数定义,您就可以启动 运行 cron 调度:
public static void CronJob([TimerTrigger("0 */5 * * * *")] TimerInfo timer)
{
Console.WriteLine("Cron job fired!");
}
Webjobs 扩展还打开了一个充满其他可能性的世界,因此如果您正在使用 Azure Webjobs,它们 100% 值得一试:https://github.com/Azure/azure-webjobs-sdk-extensions
我有一个程序,我想每天 运行 一次。我将 program.exe 和 settings.job 放在一个压缩文件中并上传。我坐着运行ning模式连续。我的 settings.job 看起来像:
{
"schedule": "0 0 8 * * *"
}
我的计划是每天 8 点 运行s,但 运行s 一直一遍又一遍地重复。 我做错了什么?
你的 webjob 运行 模式应该是 On Demand
:
来自文档:
- You still need Always On setting to be enabled on the app.
- Note: when deploying a WebJob from Visual Studio, make sure to mark your settings.job file properties as 'Copy if newer'.
经过数天尝试在 CRON 表达式上创建难以捉摸的 Azure WebJob 运行,但未成功,遵循顶级在线教程:
- https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/#CreateScheduledCRON
- http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/#.V5irdlcdpw8
- http://www.samulihaverinen.com/web-development/dotnet/2016/02/24/guide-to-azure-webjobs/
我终于设法 运行 在 cron 计划上完成了我的工作。
对我来说,根文件夹中的 settings.json 从来没有用过。确实有效并且实际上非常容易实现的是使用 Azure Webjobs SDK 扩展。 这种方法为您提供了实现调度的最大灵活性,它有很好的文档记录并且有完整的示例项目:https://github.com/Azure/azure-webjobs-sdk-extensions/blob/master/src/ExtensionsSample/Samples/TimerSamples.cs
有了这么简单的函数定义,您就可以启动 运行 cron 调度:
public static void CronJob([TimerTrigger("0 */5 * * * *")] TimerInfo timer)
{
Console.WriteLine("Cron job fired!");
}
Webjobs 扩展还打开了一个充满其他可能性的世界,因此如果您正在使用 Azure Webjobs,它们 100% 值得一试:https://github.com/Azure/azure-webjobs-sdk-extensions