quartz.net cron 触发器
我在 Quartz.net 中使用 cron 触发器时遇到问题。我的代码:
var trigger = new CronTrigger("0/30 * * * * ?");
trigger.Name = "some name";
trigger.Group = "group";
scheduler.ScheduleJob(jobDetails, trigger);
它应该每 30 秒运行一次,但在最后一行发生以下异常: “根据配置的时间表,给定的触发器永远不会触发。” 有人可以帮忙吗?
i have a problem with using cron trigger in Quartz.net. My code:
var trigger = new CronTrigger("0/30 * * * * ?");
trigger.Name = "some name";
trigger.Group = "group";
scheduler.ScheduleJob(jobDetails, trigger);
it should run every 30 seconds, but on last line following exception occures:
"Based on configured schedule, the given trigger will never fire."
can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
创建 CronTrigger 的第一个参数绝不是 cron 表达式,而是触发器名称。
相反,您可以使用此重载:
更新:
您可以配置 Quartz 使用的记录器.net 来捕获一些内部错误。
我使用了 NLog,它对我调试常见错误有很大帮助。
The first parameters to create a CronTrigger is never a cron expression but the trigger name.
Instead you can use this overload:
UPDATE:
You can configure a logger which is used by Quartz.net to trap some internal error.
I used NLog and it has helped me a lot to debug common mistakes.
你试过0,30 * * * * 吗?
您的方法是正确的,但这种替代方案可能会起作用
http://www.quartz-scheduler。 org/docs/tutorials/crontrigger.html
Have you tried 0,30 * * * * ?
Your way is correct but this alternative might work
http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html
根据 CronMaker 站点的 cron 触发器应该是:
0 0/30 * 1/1 * ? *
但根据网站的说法,你的表情似乎也不错。
创建 cron 表达式的便捷站点是 CronMaker。
The cron trigger according to the CronMaker site should be:
0 0/30 * 1/1 * ? *
But your expression seems alright too according to the site.
A convenient site to create cron expressions is CronMaker.