有人可以告訴我做錯了什麼。 我想安裝qurtz,以便在啓動時它會讀取一個XML配置文件。在文件內部有一個作業激活我的HelloEmail_Job.cs類(它被正確創建,使用execute方法中的邏輯來擴展IJob)。 xml還有一個cron觸發器,用於每分鐘觸發一次的作業(純粹用於測試)quartz.net從配置XML在asp.net
但是一切都沒有錯誤地啓動,但作業從不觸發。我相信,我在配置錯誤
我有一個處理我的調度產生一個單,在程序器在我的應用程序啓動時開始(在Global.asax文件)
NameValueCollection properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "RemoteServer";
////// set thread pool info
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "true";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";
properties["quartz.dataSource.default.connectionString"] = "Data Source=CRAIG-PC\\SQLEXPRESS;Initial Catalog=MCWdb;User ID=sa;Password=mastercrud;";
properties["quartz.dataSource.default.provider"] = "SqlServer-20";
// job initialization plugin handles our xml reading, without it defaults are used
properties["quartz.plugin.xml.type"] = "Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz";
properties["quartz.plugin.xml.fileNames"] = "~/quartz_jobs.xml";
ISchedulerFactory sf = new StdSchedulerFactory(properties);
_sched = sf.GetScheduler();
我quartz_jobs.xml文件看起來像這樣
<?xml version="1.0" encoding="UTF-8"?>
<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0">
<processing-directives>
<overwrite-existing-data>true</overwrite-existing-data>
</processing-directives>
<schedule>
<job>
<job-detail>
<name>MyJob</name>
<group>MyJobs</group>
<description>sends out a test email</description>
<job-type>HelloEmail_Job</job-type>
<volatile>false</volatile>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<entry>
<key>Body</key>
<value>Hello From your website!!!!!!!!</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 * 1/1 * ? *</cron-expression>
</cron>
</trigger>
</job>
</schedule>
</job-scheduling-data>
我知道程序器與一個簡單的觸發器,因爲當我的應用程序創建它們,並安排他們動態的它完美運行正常特設工作。但我希望邏輯可重複(通過cron),並且可以通過xml配置,我的直覺是JOB_TYPE值是錯誤的。
感謝
注:這是一個網站,我HelloEmail_Job.cs在App_Code文件\調度\文件的工作生活。如果這有幫助 – Crudler 2012-04-24 10:47:44