Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load job assembly error in Quartz.NET

Tags:

quartz.net

I'm using Quartz.NET scheduler as a stand-alone windows service while from an ASP.NET app I sechedule jobs. I've a separate job assembly and i'm getting the following error

Could not load file or assembly 'AV.Scheduler.Jobs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Here is my code,

        JobDetail jobDetail = new JobDetail("testJob", null, typeof(TestJob));

        //created trigger which will fire every minute starting immediately
        SimpleTrigger trigger = new SimpleTrigger("testTrigger",
                                null,
                                DateTime.UtcNow,
                                null,
                                1,
                                TimeSpan.FromMinutes(1));

        scheduler.ScheduleJob(jobDetail, trigger);

I'm getting the error at the last line.

like image 422
VJAI Avatar asked Jun 29 '11 10:06

VJAI


1 Answers

Although already answered (in comments), I am adding an answer here for future reference.

In order for the Quartz service to execute your custom job, it needs to be somehow able to locate the job assembly. One solution is, as you suggested, to add it as a reference to the console application that starts and stops the Quartz service. However, a console application isn't always present. If this is the case, you need to place the job assembly in the same folder that Quartz.dll is located (the version of the dll that is used by the service).

An excellent resource for Quartz.Net is http://jvilalta.blogspot.com/. From particular interest regarding this topic are the following blog posts:

like image 193
kgiannakakis Avatar answered Nov 07 '22 17:11

kgiannakakis