I am having trouble trying to get Quartz.NET to work with an AdoJobStore. None of the other questions here seem to be running into the problem that I am. I was able to get it working fine without the AdoJobStore configuration but would like to persist everything in the end, however I am getting an error when trying to GetScheduler()
that I can't figure out.
Here's my quartz app.config
section:
<quartz>
<add key="quartz.scheduler.instanceName" value="XxxDefaultQuartzScheduler"/>
<add key="quartz.scheduler.instanceId" value="instance_one"/>
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz"/>
<add key="quartz.threadPool.threadCount" value="10"/>
<add key="quartz.threadPool.threadPriority" value="1"/>
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"/>
<add key="quartz.jobStore.misfireThreshold" value="60000"/>
<add key="quartz.jobStore.dataSource" value="default"/>
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"/>
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz"/>
<add key="quartz.jobStore.tablePrefix" value="QRTZ_"/>
<add key="quartz.dataSource.default.connectionString" value="Server=(local);Database=Quartz;UID=XXXX;PWD=XXXX"/>
<add key="quartz.dataSource.default.provider" value="SqlServer-20"/>
<add key="quartz.dataSource.useProperties" value="true"/>
</quartz>
And here's the relevant initialization code:
var config = (NameValueCollection) ConfigurationManager.GetSection("quartz");
ISchedulerFactory factory = new StdSchedulerFactory(config);
// This is where an ArgumentOutOfRange exception occurs:
IScheduler scheduler = factory.GetScheduler();
And the error I am getting is ArgumentOutOfRangeException
:
Length cannot be less than zero.\r\nParameter name: length
Stepping through the code I can verify the config section gets read correctly and I double and triple checked for misspellings and wrong capitalization of the config properties. I have verified the database is accessible with the connectionString
that I have.
One thing that I noticed while stepping through the code and examining the factory variable in the Immediate Window is that it always says "AllSchedulers: Count = 0" - not sure if that is because I haven't instantiated one yet or if that's part of my problem. Trying to give GetScheduler()
the instanceName
from the configuration -
factory.GetScheduler("XxxDefaultQuartzScheduler")
doesn't work either.
What am I missing/doing wrong? Please advice.
Ok, figured out my own problem - The property quartz.dataSource.useProperties should be quartz.jobStore.useProperties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With