我使用了Quartz .Net库来调度任务。
当我把它放在Production Server IIS7上时,它在me.But上工作得很好。最初它工作得很好,但3-4小时后它会自动停止。我必须重新启动调度程序。问题出在哪里。
没有任何异常日志,我正在将异常记录到日志file.But中,没有任何有关来自generated.As的错误的内容。
ISchedulerFactory schedFact = new StdSchedulerFactory();
// get a scheduler
IScheduler sched = schedFact.GetScheduler();
sched.Start();
JobDetail jobDetail = new JobDetail("myJob", null, typeof(DumbJob));
DateTime dt = DateTime.Now;
dt = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, TimeZoneInfo.Local.Id, "India Standard Time");
SimpleTrigger trigger2 = new SimpleTrigger("myTrigger",
null,
DateTime.UtcNow,
null,
SimpleTrigger.RepeatIndefinitely,
TimeSpan.FromSeconds(60));
sched.ScheduleJob(jobDetail, trigger2);发布于 2012-07-17 13:55:07
我猜这都是关于应用程序池回收的.(IIS会在经过一定数量的请求或特定时间后自动回收应用程序池)
更多信息:http://www.iis.net/ConfigReference/system.applicationHost/applicationPools/add/recycling
发布于 2015-09-17 15:51:44
请检查Quartz调度程序的线程计数。在web配置中,您可以按如下方式定义线程数。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="quartz"
type="System.Configuration.NameValueSectionHandler,
System, Version=1.0.5000.0,Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
</configSections>
<quartz>
<add key="quartz.scheduler.instanceName" value="ServerScheduler" />
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="2" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz" />
</quartz>
</configuration>我希望这能对你有所帮助。
https://stackoverflow.com/questions/11516265
复制相似问题