In my project I have to use Quartz but I don\'t know what i do wrong.
JobFactory:
public class IoCJobFactory :
This is how I did it in my application. Instead of adding the Scheduler to the ioc I only add the factory
services.AddTransient(
(provider) =>
{
return new AspJobFactory( provider );
} );
My job factory pretty much looks the same. Transient does not really matter as I only use this once anyway. My use Quartz extension method then is
public static void UseQuartz(this IApplicationBuilder app, Action configuration)
{
// Job Factory through IOC container
var jobFactory = (IJobFactory)app.ApplicationServices.GetService( typeof( IJobFactory ) );
// Set job factory
Quartz.Instance.UseJobFactory( jobFactory );
// Run configuration
configuration.Invoke( Quartz.Instance );
// Run Quartz
Quartz.Start();
}
The Quartz class is Singleton as well.