Quartz.net Working Example

I could not find a working example for Quarts.net. The examples at Quart.net site, does not compile. Found out they are build against Quartz.net version 1.0. The following is a working Quartz.net example that is built against Quartz.net 2.0 (Latest). What this job does is write a text message, “Hello Job is executed” in the console every 5 sec.

Tutorial

Start a Visual Studio 2012 project. Select Windows Console Application. Name it Quartz1 or what ever you like.

Requirements

Download Quartz.NET assembly using NUGET. Right click on project, select “Manage Nuget Packages”. Then search for Quart.NET. Once found select and install. Note that you have to have online connection for this.

Copy and past the following Code

How to delete Quartz.net job

15 Responses to Quartz.net Working Example
  1. Ruan Fourie says:

    Thank you so much! The tutorials at the Quartz.net website isn’t working and there just isn’t any documentation out for it.

  2. Bjørn Otto Vasbotten says:

    Worked without a hitch, thank you. :)

  3. Bill Kindig says:

    Thanks! This is the only quartz “Hello World” I could find.

  4. reza says:

    hi,
    thanks for your useful tutorial,
    I have a question about using quartz.net in website.
    i need to make a website that has a DB and i want to use quartz for search in website DB in any 12 hour.
    the user of website write his search key in a form and the website should search for this key any 12 hour and if that key will add to DB inform to the user by mail.
    any one here have solution ?
    thanks a lot my friends,

    • admin says:

      What I can think of, when the user enters a keyword, you store that keyword in the DB. When the Quartz.net job runs every 12 hours, it picks those keywords from DB and performs what every function you want to perform.

  5. Varaprasad says:

    I tried same in simple asp.net web application but it giving an below error

    Locating source for ‘c:\Work\OpenSource\quartznet\src\Quartz\Impl\StdSchedulerFactory.cs’. (No checksum.)
    The file ‘c:\Work\OpenSource\quartznet\src\Quartz\Impl\StdSchedulerFactory.cs’ does not exist.
    Looking in script documents for ‘c:\Work\OpenSource\quartznet\src\Quartz\Impl\StdSchedulerFactory.cs’…
    Looking in the projects for ‘c:\Work\OpenSource\quartznet\src\Quartz\Impl\StdSchedulerFactory.cs’.
    The file was not found in a project.
    Looking in directory ‘C:\Program Files\Microsoft Visual Studio 11.0\VC\crt\src\’…
    Looking in directory ‘C:\Program Files\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\’…
    Looking in directory ‘C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\’…
    Looking in directory ‘C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\’…
    Looking in directory ‘C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include’…
    The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: c:\Work\OpenSource\quartznet\src\Quartz\Impl\StdSchedulerFactory.cs.
    The debugger could not locate the source file ‘c:\Work\OpenSource\quartznet\src\Quartz\Impl\StdSchedulerFactory.cs’.

    • admin says:

      You have to download Quartz.net assembly. The following two reference requires that you have already downloaded it.

      using Quartz;
      using Quartz.Impl;

      In the tutorial, it says you can use NUGET to download the Quartz.net library. Or you can just download it independently and copy it to your project folder. Then add reference to this library before you can actually use it. Hope it helps.

  6. manoj says:

    Thanks,

    i have query , how to get table from db and mail the table. Could you please help me.

  7. Haruni says:

    Thank you very much.
    At least i have something working.

  8. payam says:

    hi. it`s a great job, tnk u. but i want to d this some times and this come from my database jobs. what should i do for using this with certain date time??

  9. Omar says:

    Hello, your tutorial was very helpful thank you, can you add something related to adding job listeners? because nothing on the web I can find seems to work and most of the examples are in Java instead of C#

  10. Weeraa says:

    This code works fine. But when I publish as a web site in IIS, the scheduler run in every minutes even the schedule time set to every 5minutes, 6minutes, etc….. What ever time time change, it’s triggered in every minute. Please give me a solution for this…

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*