1
我正在创建一个正在使用Quartz.NET(使用ADO.NET DB存储)的项目。有核心组件,即执行作业的组件(此时的控制台应用程序将是Windows服务)以及多个Web窗体,用户可以在其中添加作业和编辑作业(将数据图值编辑为特定)。在项目中为多个页面/应用程序使用Quartz.NET
我在从所有页面访问调度程序时遇到了一些问题 - 核心组件和“添加作业”页面完美无缺,完全没有问题。但在他们,我基本上是这样两个:
NameValueCollection properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "schedService";
properties["quartz.scheduler.instanceId"] = "sched1";
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "10";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.misfireThreshold"] = "60000";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "false";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
properties["quartz.jobStore.clustered"] = "true";
// if running MS SQL Server we need this
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";
properties["quartz.dataSource.default.connectionString"] = "Data Source=CHRIS\\SQLEXPRESS;Initial Catalog=Scheduler;Integrated Security=True;Pooling=False";
properties["quartz.dataSource.default.provider"] = "SqlServer-20";
ISchedulerFactory schedService = new StdSchedulerFactory(properties);
IScheduler sched = schedService.GetScheduler();
当我做同样的编辑页面,它告诉我,已经有一个名为此调度。
我知道我可能在做些什么真的很愚蠢,但是我怎样才能在我所有的页面中声明调度器,这样我就可以访问它们了?
感谢哥们,明天我会试一试,让你知道它是怎么回事 – Chris 2010-10-21 21:39:56
从[Quartz.NET教程](http://quartznet.sourceforge.net/tutorial/lesson_11.html):每个节点都在集群必须具有唯一的instanceId,通过将“AUTO”作为该属性的值,可以轻松完成(不需要不同的属性文件)。 – 2012-07-25 00:37:16