Quartz.NET工作我有一個ASP.NET MVC 4 Web應用程序和運行quartz.net作爲Windows服務和公共記錄,根據這些資源進行配置:執行從Windows服務
,並與該代碼在Global.asax中到位:
var properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "ServerScheduler";
// set thread pool info
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
// set remoting expoter
properties["quartz.scheduler.proxy"] = "true";
properties["quartz.scheduler.proxy.address"] = "tcp://localhost:555/QuartzScheduler";
// construct a scheduler factory
ISchedulerFactory schedFact = new StdSchedulerFactory(properties);
// get a scheduler
IScheduler sched = schedFact.GetScheduler();
sched.Start();
IJobDetail jobDetail = JobBuilder.Create<SimpleJob>()
.WithIdentity("simpleJob", "simpleJobs")
.RequestRecovery()
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("simpleTrigger", "simpleTriggers")
.StartNow()
.WithSimpleSchedule(x => x.WithRepeatCount(4).WithIntervalInSeconds(10))
.Build();
sched.ScheduleJob(jobDetail, trigger);
和作業:
public class SimpleJob : IJob
{
public SimpleJob()
{
}
public void Execute(IJobExecutionContext context)
{
Debug.WriteLine("I Executed at " + DateTime.Now.ToString());
}
}
現在如果我運行應用程序日誌產生這樣的5倍
19:35:23 [ServerScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread - Batch acquisition of 1 triggers
19:35:23 [ServerScheduler_QuartzSchedulerThread] DEBUG Quartz.Simpl.SimpleJobFactory - Producing instance of Job 'simpleJobs.simpleJob', class=Navigate.Quartz.Jobs.SimpleJob
19:35:23 [ServerScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread - Batch acquisition of 1 triggers
19:35:23 [ServerScheduler_Worker-1] DEBUG Quartz.Core.JobRunShell - Calling Execute on job simpleJobs.simpleJob
19:35:23 [ServerScheduler_Worker-1] DEBUG Quartz.Core.JobRunShell - Trigger instruction : NoInstruction
然後刪除觸發器和進行,但執行沒有工作,沒有臺詞寫入調試輸出
如果我運行內嵌在應用中,然而,沒有通過的NameValueCollection到StdSchedulerFactory
ISchedulerFactory schedFact = new StdSchedulerFactory();
調度10
一切工作正常,我也得到了行輸出每10秒
I Executed at 28.05.2013. 19:47:48
I Executed at 28.05.2013. 19:47:58
I Executed at 28.05.2013. 19:48:08
I Executed at 28.05.2013. 19:48:18
I Executed at 28.05.2013. 19:48:28
我缺少什麼,爲什麼心不是實際執行代碼的Windows服務,該服務作爲本地系統運行,沒有什麼如果我改變了5倍將其更改爲管理員帳戶。任何幫助將不勝感激。
克里斯
任何線索有人嗎? :( – DoubleZ