Could not load job assembly error in Quartz.NET

萝らか妹 提交于 2019-12-22 03:52:29

问题


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.


回答1:


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:

  • Getting Started With Quartz.Net: Part 1
  • Creating a Custom Job in Quartz.Net


来源:https://stackoverflow.com/questions/6519285/could-not-load-job-assembly-error-in-quartz-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!