12

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.

LeftyX
  • 35,328
  • 21
  • 132
  • 193
VJAI
  • 32,167
  • 23
  • 102
  • 164
  • Are you in debug mode? Where is this happening: services or asp.net? – LeftyX Jun 29 '11 at 10:41
  • Through a console application I'm starting the Quartz Server and from asp.net application I'm scheduling jobs. This exception is happening at the asp.net web page. I'm starting the console application by directly launching the exe file under the bin folder. The console application is a test application when things are working fine I'll move it to a service. – VJAI Jun 29 '11 at 10:45
  • I solved the problem by adding the reference to the job assembly in the console application where the scheduler is triggering jobs. Thanks for your help. – VJAI Jun 29 '11 at 10:55
  • sorry, I couldn't reply before but I was busy. Yes, that was the right thing to do ;-) – LeftyX Jun 29 '11 at 10:59

1 Answers1

6

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:

kgiannakakis
  • 103,016
  • 27
  • 158
  • 194
  • Hi @kgiannakakis I am facing the same problem Quartz.JobPersistenceException: Couldn\'t retrieve job because the BLOB couldn\'t be deserialized: Could not load file or assembly \'Enterprise.Appointments.Exchange\' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly \'Enterprise.Api.Appointments.Exchange\' or one of its dependencies. The system cannot find the file specified. Mine is a webapi and Enterprise.Appointments.Exchange.Dto already referenced. – Vardhan Aug 02 '17 at 07:48