Constructor injection with Quartz.NET and Simple Injector

According to this blog post, you would need to implement a custom IJobFactory, like this: public class SimpleInjectorJobFactory : IJobFactory { private readonly Container container; private readonly Dictionary<Type, InstanceProducer> jobProducers; public SimpleInjectorJobFactory( Container container, params Assembly[] assemblies) { this.container = container; // By creating producers, jobs can be decorated. var transient = Lifestyle.Transient; this.jobProducers = … Read more

Get all jobs in Quartz.NET 2.0

You can use fetch a list of executing jobs: var executingJobs = sched.GetCurrentlyExecutingJobs(); foreach (var job in executingJobs) { // Console.WriteLine(job.JobDetail.Key); } or fetch all the info about scheduled jobs (sample console application): private static void GetAllJobs(IScheduler scheduler) { IList<string> jobGroups = scheduler.GetJobGroupNames(); // IList<string> triggerGroups = scheduler.GetTriggerGroupNames(); foreach (string group in jobGroups) { var … Read more

How to start Quartz in ASP.NET Core?

TL;DR (full answer can be found below) Assumed tooling: Visual Studio 2017 RTM, .NET Core 1.1, .NET Core SDK 1.0, SQL Server Express 2016 LocalDB. In web application .csproj: <Project Sdk=”Microsoft.NET.Sdk.Web”> <!– …. existing contents …. –> <!– add the following ItemGroup element, it adds required packages –> <ItemGroup> <PackageReference Include=”Quartz” Version=”3.0.0-alpha2″ /> <PackageReference Include=”Quartz.Serialization.Json” … Read more

IIS app pool recycle + quartz scheduling

Yes! http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx details it quite nicely, basically you need to: Edit C:\Windows\System32\inetsrv\config\applicationHost.config to include: <applicationPools> <add name=”MyAppWorkerProcess” managedRuntimeVersion=”v4.0″ startMode=”AlwaysRunning” /> </applicationPools> Declare what should be run as the “warm-up” for your site <sites> <site name=”MySite” id=”1″> <application path=”https://stackoverflow.com/” serviceAutoStartEnabled=”true” serviceAutoStartProvider=”PreWarmMyCache” /> </site> </sites> <serviceAutoStartProviders> <add name=”PreWarmMyCache” type=”PreWarmCache, MyAssembly” /> </serviceAutoStartProviders> Configure your application with whatever … Read more

Quartz.Net Job Storage Query

you can use AdoJobStore. Quartz.net will use a set of tables with prefix QRTZ_ (you can change it if you want) in your database to stored jobs, triggers and status of these objects. I guess you want to have a table in your DB where you’re going to keep extended information about your schedules, right? … Read more

Quartz.net setup in an asp.net website

Did you try the quartz.net tutorial? Since your web app might get recycled/restarted, you should probably (re-)intialize the quartz.net scheduler in the Application_Start handler in global.asax.cs. Update (with complete example and some other considerations): Here’s a complete example how to do this using quartz.net. First of all, you have to create a class which implements … Read more