与SQL Server AdoJobStore配置Quartz.NET [英] Configuring Quartz.NET with SQL Server AdoJobStore

查看:565
本文介绍了与SQL Server AdoJobStore配置Quartz.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有麻烦试图让Quartz.NET与AdoJobStore工作。没有这里的其他问题似乎遇到了,我的问题。我能得到它的工作的罚款,而不AdoJobStore配置,但要坚持一切到底,但是我想的getScheduler(),我可以当得到一个错误T弄清楚。

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.

下面是我的石英的app.config 部分:

<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>

和这里的相关初始化code:

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();

和我收到的错误是 ArgumentOutOfRangeException

长度不能小于零\ r \ n参数名:长度

Length cannot be less than zero.\r\nParameter name: length

通过code步进我可以验证配置部分被正确地读出,我再三地检查拼写错误和配置属性的错误的资本。我已经验证数据库与访问的connectionString ,我有。

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.

有一件事,我注意到,同时通过code加强和检查在立即窗口工厂变量,它总是说AllSchedulers:计数= 0 - 不知道这是因为我还没有实例1但如果这是我的问题的一部分。试图给的getScheduler()实例名从配置 -

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.

推荐答案

好了,想通了,我自己的问题 - 。物业石英数据源 .useProperties应该是石英的作业存储 .useProperties

Ok, figured out my own problem - The property quartz.dataSource.useProperties should be quartz.jobStore.useProperties

这篇关于与SQL Server AdoJobStore配置Quartz.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆