Ai đó có thể tư vấn về những gì tôi đang làm sai. Tôi đang cố gắng thiết lập qurtz để khởi động nó sẽ đọc tệp cấu hình xml. bên trong tập tin có một công việc kích hoạt lớp HelloEmail_Job.cs của tôi (nó được tạo ra một cách chính xác, mở rộng IJob với logic trong phương thức execute). xml cũng có kích hoạt cron cho công việc sẽ kích hoạt mỗi phút (hoàn toàn là thử nghiệm)quartz.net từ config xml trong asp.net
nhưng mọi thứ khởi động mà không có lỗi, nhưng công việc không bao giờ cháy. tôi chắc chắn tôi cấu hình sai
Tôi có một singleton để xử lý việc tạo ra lịch trình của tôi, schedular bắt đầu từ ngày khởi động của ứng dụng của tôi (trong file 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 của tôi tệp trông giống như thế này
<?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>
Tôi biết rằng lịch biểu đang chạy chính xác cho công việc quảng cáo với một trình kích hoạt đơn giản vì khi ứng dụng của tôi tạo và lên lịch hoạt động hoàn hảo. nhưng tôi muốn logic được lặp lại (thông qua cron) và có thể định cấu hình thông qua một xml
cảm giác ruột của tôi là giá trị JOB_TYPE sai.
Cảm ơn
lưu ý: đây là một trang web, và HelloEmail_Job.cs tôi nộp sống trong App_Code \ scheduler \ việc làm. nếu điều này giúp ích ở tất cả các số – Crudler