How to get Quartz.Server.exe to run my ASP.NET job

2019-08-07 13:18发布

I have an ASP.NET website that generates documents. Each document takes a while to generate, and there are many document requests, so I am exploring the idea of using Quartz.NET to help pool the requests, persist them through restarts, and deliver them to users for a better experience.

Quartz.Server.exe is included in the download, and it appears to be a daemon for running Quartz jobs even when the front-end is not running. This is obviously perfect for a web scenario like mine.

The main problem is that Quartz.Server.exe cannot instantiate the job type that I provide.

Could not load file or assembly 'quartztest01' or one of its dependencies. The system cannot find the file specified. --

This makes sense because my assembly, quartztest01, is not in the GAC, and Quartz.Server.exe doesn't know anything about my assembly. But a lot of questions are raised when I try to resolve this.

  1. I would prefer not to have my assembly in the GAC. How can I accomplish this? Rebuild Quartz.Server.exe with a reference to my assembly?
  2. Am I even taking the right approach? The front-end, and Quartz.Server.exe are using the same data store, and configured as clustered, but I am paranoid that it will operate.
  3. Is Quartz.Server.exe even meant for production use? It appears to create a sample job which to me indicates it's just meant as an example. Am I supposed to modify this exe to meet my own needs?
  4. What is the best way to install Quartz.NET as a legitimate Windows service, instead of this console application?

2条回答
We Are One
2楼-- · 2019-08-07 13:37
  1. You don't have to install in the GAC. Just make sure you assembly is either in the same folder as the quartz.dll or that the framework can find it using the usual techniques for locating assemblies.
  2. Yes, it's quite common to have the UI act as a client and thus it has to point to the same store. What is not common is to set the scheduler as clustered unless the UI will also be acting as a server.
  3. Yes. Quartz.Server.exe install installs it as a service.
  4. The link in @James comment is the answer for this.

FWIW, installing Quartz.net as a service is usually a better solution than embedding it into an ASP.Net web app due to the way the web application lifecycle is managed by IIS.

查看更多
家丑人穷心不美
3楼-- · 2019-08-07 13:54

Just put your assembly in the same dir as the server exe, it should load it fine. You could use probePath too, but not likely needed for this.

查看更多
登录 后发表回答