admin管理员组文章数量:1406950
I have developed a Windows service using Quartz.Net . I deployed it on one machine, everything works fine. The trigger is triggered at the right time. But by deploying the same deployment on the second machine, the trigger simply does not work. He registers, the schedule is running, but he does not work out. I don't understand what the problem might be if it works on one machine and not on the other... I've looked at all the possible issues.
Here is the Quartz configuration code:
{
try
{
var jobFactory = new JobFactory(_serviceProvider);
_scheduler.JobFactory = jobFactory;
var triggers = new List<ITrigger>();
foreach (var location in LocationCronExpression.Keys)
{
string cronExpression = LocationCronExpression[location];
var jobDetail = JobBuilder.Create<CronJob>()
.WithIdentity($"CronJob_{location}", "DefaultGroup")
.UsingJobData("Location", location)
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity($"Trigger_{location}", "DefaultGroup")
.WithSchedule(CronScheduleBuilder
.CronSchedule(cronExpression)
.InTimeZone(TimeZoneInfo.Local))
.ForJob(jobDetail)
.Build();
await _scheduler.ScheduleJob(jobDetail, trigger);
triggers.Add(trigger);
ServiceLogger.Log.Debug($"Зарегистрирован триггер: {trigger.Key.Name} для тегов с location4 = {location}");
}
ServiceLogger.Log.Debug("Триггеры зарегистрированы.");
await _scheduler.Start();
}
ServiceLogger.Log.Debug($"Quartz запущен. {_scheduler.IsStarted}");
foreach(var trigger in triggers)
{
DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
if (nextFireTime.HasValue)
{
ServiceLogger.Log.Debug($"Следующее выполнение триггера {trigger.Key.Name} для {trigger.JobKey.Name}: {nextFireTime.Value.DateTime}");
}
else
{
ServiceLogger.Log.Debug("Триггер не запланирован на выполнение");
}
}
ServiceLogger.Log.Debug($"Scheduler shutdown??? {_scheduler.IsShutdown}");
}
catch (Exception ex)
{
ServiceLogger.Log.Fatal("Ошибка при создании расписания запуска службы: " + ex);
return;
}
}
本文标签: cQuartzNET The trigger is not triggeredStack Overflow
版权声明:本文标题:c# - Quartz.NET The trigger is not triggered - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745051447a2639680.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论