I am a total noob to Quartz.net and writing windows services, so I apologize if this question is a bit uninformed.
Anyway, I set up a windows service to use quartz.net to run another windows service which does some file cleanup. It installs and runs just fine (at least according to installutil and the net start command), but it never adds anything to the database.
I created the db tables and everything and the db itself looks fine. Then, I created an app.config, which contains (i think) all of the config settings i need to be using to hook this thing up to the db. But for some reason, the db never gets touched. No triggers created (i obviously created them in code), no queued jobs, nothing.
It is an oracle db, and all of the permissions are set up to allow read/write and everything.
Here is the source code for the app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<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="TestQuartzServer" />
<add key="quartz.scheduler.instanceId" value="instance_one" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="false" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.clustered" value="true" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.SimpleSemaphore, Quartz" />
<add key="quartz.dataSource.default.connectionStringName" value="ConnectionString" />
<add key="quartz.dataSource.default.provider" value="OracleClient-20" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz" />
</quartz>
<connectionStrings>
<add name="ConnectionString" connectionString= "Server=localhost;Database=Quartz;Uid=Quartz;Pwd=Quartz" />
</connectionStrings>
</configuration>
And here is the app source:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using Quartz;
using Quartz.Impl;
using Quartz.Impl.Triggers;
using System.Collections;
namespace PurgeScheduler1
{
public partial class Service1 : ServiceBase
{
public static IScheduler _scheduler;
public Service1()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
try {
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
_scheduler = schedulerFactory.GetScheduler();
_scheduler.Start();
AddJob();
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
protected override void OnStop()
{
}
public static void AddJob()
{
IJob myJob = new MyJob();
JobDetailImpl jobDetail = new JobDetailImpl("Purge", "Group1", myJob.GetType());
CronTriggerImpl trigger = new CronTriggerImpl("Trigger1", "Group1", "When to run it goes here");
SimpleTriggerImpl trigger1 = new SimpleTriggerImpl("Trigger2", 10, TimeSpan.FromMinutes(2));
_scheduler.ScheduleJob(jobDetail, trigger1);
DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
Console.WriteLine("Next Fire Time:" + nextFireTime.Value);
}
}
internal class MyJob : IJob
{
public void Execute(IJobExecutionContext context)
{
Console.WriteLine("In myJob class");
Process.Start("correct path, but hiding it for proprietary reasons");
}
}
}