正如標題所說,我不能讓Quartz.NET在所有的工作。我有Quartz.NET(2.2.1)的最新版本,common.logging(2.1.2),common.logging.nlog(2.0.0),並從的NuGet NLOG(2.1.0)。觸發器沒有觸發,Quartz沒有任何記錄。我猜我搞砸了配置。Quartz.NET:觸發器沒有得到觸發,沒有得到記錄
我的App.config:
<?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" />
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog">
<arg key="configType" value="FILE" />
<arg key="configFile" value="~/NLog.config" />
</factoryAdapter>
</logging>
</common>
<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>
...
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
...
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
還有一個工作,一個觸發與之相關聯:
{Trigger 'DEFAULT.DailyYahooUpdateTrigger': triggerClass: 'Quartz.Impl.Triggers.CronTriggerImpl calendar: '' misfireInstruction: 0 nextFireTime: 01/29/2014 18:38:00 +00:00}
[Quartz.Impl.Triggers.CronTriggerImpl]: {Trigger 'DEFAULT.DailyYahooUpdateTrigger': triggerClass: 'Quartz.Impl.Triggers.CronTriggerImpl calendar: '' misfireInstruction: 0 nextFireTime: 01/29/2014 18:38:00 +00:00}
CalendarName: null
Description: null
EndTimeUtc: null
FinalFireTimeUtc: null
HasMillisecondPrecision: false
JobDataMap: {Quartz.JobDataMap}
JobKey: {DEFAULT.DailyYahooUpdate}
Key: {DEFAULT.DailyYahooUpdateTrigger}
MisfireInstruction: 0
Priority: 5
StartTimeUtc: {29/1/2014 18:37:44 +00:00}
啓動調度程序,作業和觸發正確添加,並且否則記錄工作。 nextFireTime來來去去,沒有任何反應。
觸發創建代碼:
ITrigger trigger = TriggerBuilder
.Create()
.WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(jobDetails.Time.Hours, jobDetails.Time.Minutes))
.StartNow()
.WithIdentity(jobDetails.Name + "Trigger")
.Build();
你如何創建你的觸發器,你能告訴我們cron表達式嗎? – LeftyX
我已經更新與創建觸發器的代碼的問題。 –
需要更多代碼來重現問題:jobDetails聲明(它來自哪裏)以及如何將作業/觸發器對添加到調度程序。 – cvbarros