Friday, January 28, 2011

Installing Quartz.Net 2.0 as a Windows Service

NOTE: I'm now blogging at and not updating this blog anymore. For information on the latest version of Quartz.Net, visit me there.

UPDATE: I've written a new post that has been updated with the release of Beta 1. Take a look at this newer post instead.
Quartz.Net 2.0 is currently under development. No official release (beta or otherwise) is available yet but if you really want to get started with it, you can download the source code from Github and build it yourself. In this post I am going to describe how to install the latest version of Quartz.Net 2.0 from source.

Getting the Source

If you are familiar with Git, Github and how it works, then just download the repository locally using whatever method you prefer. There are a lot of posts and even a free book on how to use Git, so I am not going to go over that stuff here.
If you’re not familiar with how to use Git or Github, then go ahead and download a zipped file of the source from here.
At this point I am going to assume that you have already downloaded the Quartz.Net source code and that it is in a folder somewhere on your drive. On my box I have downloaded the source to C:\git\quartznet, and the image below shows what that folder looks like. Your folder should look similar to the screenshot below.

Building The Source Code

Since this post is about installing Quartz.Net 2.0 as a windows service, let’s build the server project.
Instructions for Visual Studio 2008 and .Net 3.5
Double click on the Quartz.Server.2008.sln file if you have Visual Studio 2008 installed. This will open the file in VS 2008. Build the solution by pressing F6. This will build the binaries targeting the 3.5 framework. The build output for this project can be found under the build\3.5\Debug\Quartz.Server folder, as shown below.
Instructions for Visual Studio 2010 and .Net 4.0
If you have Visual Studio 2010 installed, double click on the Quartz.Server.2010.sln file to open it in VS 2010. Build the solution by pressing F6. This will build the binaries targeting the 4.0 framework. The build output for this project can be found under the build\4.0\Debug\Quartz.Server folder, as shown below.

Installing Quartz.Net 2.0 as a Windows Service

Now that you have built the source code, let’s install the service. Open a command prompt as administrator (if you are running a Vista or later OS) and cd to the directory that contains the Quartz.Server.exe file. This directory will be different based on whether you use VS 2008 or VS 2010, so double check that the file exists first in one of the paths that I mention above. At this point, all that is left is to install the service. Type the following into your command prompt:
Quartz.Server.exe install
If all goes well, then you should see the following in your command prompt window (replace 3.5 with 4.0 where appropriate):
By default, the service is installed with a startup type of automatic and under the Local System account. To uninstall, type the following into your command prompt:
Quartz.Server.exe uninstall
Now, go fire that puppy up and start experimenting!
As always, let me know in the comments if this stuff is useful and what topics you’re interested in reading about.


mokumax said...

I need to run call a c# .net webservice every 2 minutes. I don't have access to the server so I can't schedule anything. Can Quartz work for me?

J said...

In order to use Quartz.Net you'll have to be able to install a windows service, so if you don't have access to do this, then you probably don't want to use it. You can also embed Quartz.Net in your application, but I don't think this second option is available to you if you can't install a windows service in the first place. Finally, you could potentially embed it in your ASP.Net application, but because the worker process can be recycled at any time, you will not be able to guarantee that the web service call is made every 2 minutes.

Fathom Savvy said...

Thanks J. I'm building an automated FTP service that monitors FTP directories. I didn't know a new version of Quarz.NET was available. Thanks for the link to the zipped solutions! Hope some documentation becomes available soon.

markd148 said...

Hi J, I have downloaded the latest code and installed Quartz.Net as a Windows service configured to look at an adojobstore based on SQL Server. When I try to add jobs from a remote client the client is receiving an error of 'Couldn't determine job existence(): Object reference not set to instance of an object'.
I have attached a debugger to the service and it looks like a JobPersistenceException is being thrown in ExecuteInNonManageTXLock when the result object is created. Do you have any ideas on why this is or how to get around it?

J said...

This seems to be a bug... would you logging a bug for this?

Coryt said...

Hi there, great blog, very helpful getting up to speed with

We are running the latest from github, and trying to get the server running as a service on a win 2k8 r2 box. It works fine if I disable remoting, but with remoting enabled, I get the following error:

Server initialization failed:Unable to bind scheduler to remoting.

Quartz.SchedulerException: Unable to bind scheduler to remoting. ---> System.Runtime.Remoting.RemotingException: The channel 'tcp' is already registered.

I've tried specifying a different port but no luck. This is a dev box with iis running along side it. Is this the conflict?

thanks in advance!

Coryt said...

I found the issue. I needed to modify the source to specify a channel name. tcp had already been used.

J said...

Thanks for posting the fix here!

Coryt said...

No problem! I've sent a pull request with a fix for the conflicting http channel name also.

J said...

Excellent. Thanks for the contribution. I believe Marko is on vacation so it might take him a while to incorporate it.

Aph5 said...
This comment has been removed by the author.
Aph5 said...

Ok... but

lets assume that I have got a quartz.server installed as a windows service and few jobs with dependencies to my services.

How should I resolve these dependencies? Hard-code them into the jobs ?

(When I was running quartz embeded in my app I was using a windsor intgration)

Marcos Tito de Pardo Marques said...

Dear sirs,

The command to install Quartz 2.01 beta 1 as a Windows Service is not working for me.

When I execute the command, nothing happens and no message is displayed.

Could you, please, help me ?

I have downloaded Quartz .NET 2.01 beta 1 from sourceforge.

Thank you,

Marcos Tito de Pardo Marques said...

Hi Guys,

Is it possible to install Quartz.NET on IIS 7 as a host, instead of Windows Service ?

If so, How do that ?

Thank You.

J said...

Hi Markos

I've written a new post that explains how to install Quartz.Net 2.0 Beta 1. Take a look and let me know if it works for you:

WRT to installing Quartz.Net under IIS, take a look at this StackOverflow question:

Anonymous said...

Hi J., I followed the steps to install Quartz.Net and it works. But, I need to integrate this to my app. Can you explain me how can I do that?
My aplication was made in Visual Studio 2010


J said...

Hi Deborah

Are you trying to embed Quartz.Net in your application or are you trying to connect to the scheduler that was installed as a windows service?

Anonymous said...

Nicely explained.... thanks for your help!!!

Anonymous said...

Pounding my head against a remoting issue. Able to create scheduler object on client, but when scheduling job, I get an internal error message returned from the server. I tried all of the customError fixes to no avail. Finally, I telnet into the remote service to check and get a tcp protocol violation message : expecting preamble. Any help will be appreciated. About to have to scrap using since I can't get the remoting to work.