Hi everyone
I'm using Quartz in my .NET application. At first, I was using it in a windows service but it didn't work, so I moved it to a normal project to test it. This is the code in Main:
ISchedulerFactory schedFact = new StdSchedulerFactory();
IScheduler sched = schedFact.GetScheduler();
JobDetail jobDetail = new JobDetail("JobPrueba", null, typeof(JobPrueba));
Trigger trigger = TriggerUtils.MakeMinutelyTrigger(1, 3);
trigger.StartTimeUtc = DateTime.Now;
trigger.Name = "TriggerPrueba";
sched.Start();
sched.ScheduleJob(jobDetail, trigger);
and this is JobPrueba:
class JobPrueba : IStatefulJob
{
public JobPrueba() { }
public void Execute(JobExecutionContext context)
{
const string fic = @"C:\prueba.txt";
string texto = DateTime.Now.ToString();
System.IO.StreamWriter sw = new System.IO.StreamWriter(fic, true);
sw.WriteLine(texto);
sw.Close();
System.Console.WriteLine("Hello world");
}
}
It's not doing anything at all, when last line in Main is executed, the program never ends, but it doesn't write in file nor print Hello World in console.
Does anyone know what I am doing wrong?
Thanks a lot in advance!