问题
I just started with Quartz.net and I have it running as a service. I created a Job and moved the resulting .dll to the Quartz folder and added a new entry to the jobs.xml file to kick it off every 3 seconds.
I updated the job .dll but it is in use by Quartz (or is locked).
Is it possible to update the .dll without restarting the Quartz service? If not what would happen to a long running job if I did stop/start the Quartz service?
回答1:
You cannot update the job dll without restarting the service. Once the server has started it loads the the job dll and the loaded types stay in memory. This is how .NET runtime works. To achieve something like dynamic reloading you would need to use programmatically created app domains etc.
If you stop the scheduler you can pass a bool parameter whether to wait for jobs to complete first. Then you would be safe with jobs completing and no new ones would spawn meanwhile the scheduler is shutting down.
来源:https://stackoverflow.com/questions/3327994/update-quartz-net-job-dll-without-service-restart