本文介绍了“Quartz.Plugin.Xml.JobInitializationPlugin,Quartz”类型的SchedulerPlugin无法实例化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用quartz.net来安排工作。但是,当我运行代码时,它显示错误类型'Quartz.Plugin.Xml.JobInitializationPlugin的SchedulerPlugin,Quartz'无法实例化。
这里代码
I have used the quartz.net for scheduling the job. However, when I run the code, it is showing the error "SchedulerPlugin of type 'Quartz.Plugin.Xml.JobInitializationPlugin, Quartz' could not be instantiated".
Here the code
static void Main(string[] args)
{
IScheduler _scheduler = null;
// start up scheduler`enter code here`
// construct a factory `enter code here`
ISchedulerFactory factory = new StdSchedulerFactory();
// get a scheduler
_scheduler = factory.GetScheduler();
// start the scheduler
_scheduler.Start();
Console.ReadLine();
}
这个app.config文件
This the app.config file
<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="QuartzScheduler" />
<!-- Configure Thread Pool -->
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />
<!-- Configure Job Store -->
<add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz" />
<add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.JobInitializationPlugin, Quartz" />
<add key="quartz.plugin.xml.fileNames" value="~/quartzjobs.config" />
</quartz>
这是quartzjobs.config文件
and this is the quartzjobs.config file
<?xml version="1.0" encoding="UTF-8"?>
<quartz xmlns="http://quartznet.sourceforge.net/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" overwrite-existing-jobs="true">
<job>
<job-detail>
<name>MyJob</name>
<group>MyJobs</group>
<description>Logs a message to the application log</description>
<job-type>Sample.MyJob, Sample</job-type>
<volatile>false</volatile>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<entry>
<key>MessageToLog</key>
<value>Hello from MyJob</value>
</entry>
</job-data-map>
</job-detail>
<trigger>
<cron>
<name>MyJobTrigger</name>
<group>MyJobs</group>
<description>A description</description>
<job-name>MyJob</job-name>
<job-group>MyJobs</job-group>
<cron-expression>0 0/1 * * * ?</cron-expression>
</cron>
</trigger>
</job>
</quartz>
推荐答案
这篇关于“Quartz.Plugin.Xml.JobInitializationPlugin,Quartz”类型的SchedulerPlugin无法实例化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!