Search code examples
windows-servicesquartz.netwindows-serverquartz.net-2.0

Quartz.net not firing on remote server


I've implemented quartz.net in windows service to run tasks. And everything works fine on local workstation. But once it's deployed to remote win server host, it just hangs after initialization.

ISchedulerFactory schedFact = new StdSchedulerFactory();

// get a scheduler
var _scheduler = schedFact.GetScheduler();

// Configuration of triggers and jobs
var trigger = (ICronTrigger)TriggerBuilder.Create()
                                          .WithIdentity("trigger1", "group1")
                                          .WithCronSchedule(job.Value)
                                          .Build();

var jobDetail = JobBuilder.Create(Type.GetType(job.Key)).StoreDurably(true)
                                .WithIdentity("job1", "group1").Build();

var ft = _scheduler.ScheduleJob(jobDetail, trigger);

Everything seems to be standard. I have private static pointer to scheduler, logging process stops right after jobs are initialized and added to scheduler. Nothing else happens after. I'd appreciate any advices.

Thanks.

PS:

Found some strange events in event viewer mb according quartz.net:

Restart Manager - Starting session 2 - ‎2012‎-‎07‎-‎09T15:14:15.729569700Z.
Restart Manager - Ending session 2 started ‎2012‎-‎07‎-‎09T15:14:15.729569700Z.

Solution

  • Based on your question and the additional info you gave in comments, I would guess there is something going wrong in the onStart method of your service.

    Here are some things you can do to help figure out and solve the problem:

    1. Place the code in your onStart method in a try/catch block, and try to install and start the service. Then check windows logs to see if it was installed correctly, started correctly, etc.
    2. The fact that restart manager is running leads me to believe that your service may be dependent on a process which is already in use. Make sure that any dependencies of your service are closed before installing it.
    3. This problem can also be caused by putting data-intense or long running operations in your onStart method. Make sure that you keep this kind of code out of onStart.