Monday, December 19, 2011

Installing Multiple Instances of Quartz.Net on One Machine

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

It’s possible to have multiple instances of Quartz.Net on one machine. This is especially useful if you want to run an instance of Quartz.Net 2.0 alongside an existing Quartz.Net 1.0 instance. However, you can install 2 (or more) instances of Quartz.Net 2.0 on the same box if that’s what you want. Fortunately for us, this can all be done via the configuration file.

Pre-Requisite (Step 0)

First you need to create a separate directory for the new Quartz.Net instance that we are about to create. You can/should follow the steps outlined in this post all the way up to and including step 3. Do not install the service just yet. This is where the configuration changes come into play.
At this point I am going to assume that you have all of your Quartz.Net files in a new directory and that you have verified that the scheduler starts up properly. We’re now ready to configure the scheduler so that we can install an instance of Quartz.Net with a name of our choosing.

Step 1 – Change the Configuration File

In order to the change the Quartz.Net service name, we’re going to be modifying the Quartz.Server.exe.config file. Open up the file in your favorite editor and look for the <quartz> section. In the default distribution, this section is commented out (shown in green below).
We’ll uncomment it and add a few settings in there. Here is what the configuration file looks with our changes:
And here is the <quartz> section itself, so that you can cut and paste it into your configuration file. Feel free to name your service appropriately.
<quartz >
  <add key="quartz.checkConfiguration" value="false"/>
  <add key="quartz.server.serviceName" value="JQuartz"/>
  <add key="quartz.server.serviceDisplayName" value="JQuartz"/>
  <add key="quartz.server.serviceDescription" value="JQuartz description"/>

Step 2 – Install the Service

Installing the service is now pretty straightforward. Open a command prompt as administrator in the same folder where your new service files are. Now type Quartz.Server.exe install in the command prompt and watch as the service installs. You can also refer to this post if you want a few more details on the install itself. After installing, you should now have a Quartz.Net service with the same name you specified in the configuration file. We’ll talk about the configuration itself now, but if you already know what the configuration keys above do, feel free to skip the next section and I’ll see you next time.

Appendix – The Configuration Details

If you’re still here then you probably want to know a bit more about the changes we made, so let’s take a look at the configuration itself. First, let me start by saying that you MUST make these changes to the Quartz.Server.exe.config file. Modifying the Quartz.config file will not work. Also, you must set the checkConfiguration key to false, otherwise the scheduler will throw an exception.
The keys themselves are quite explanatory, but I’ll illustrate with a picture of where these keys end up once you install the service. For the configuration above, this is what the installed service looks like:
Finally, be sure to provide both the serviceName and serviceDisplayName values when doing a custom install and make sure that the names are unique so that the installation process works properly.
I’ve tested this on Windows 7 and Windows 2K3, so let me know if you run into any issues.

Friday, December 2, 2011

Installing Quart.Net 2.0 Beta 1 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.

Now that there is an official beta release of Quartz.Net 2, I thought it would be a good idea to go through the installation process and describe it step by step. Before we get started I’d like to point out that this post was written using Windows 7, so the screenshots may not match exactly what you see if you are on a different version.

Step 1: Download and Unpack the Binaries

The latest Quartz.Net 2.0 binaries are available from Sourceforge, here. Download the zip file and unpack the contents to a folder. If you are using Windows 7, be sure to unblock the downloaded zip file before extracting the files. This is done by right clicking on the downloaded file and clicking on the unblock button BEFORE unzipping the file.
I will be unzipping the file to c:\quartznet2 for this article. Once you’ve downloaded and unpacked the files, you should have the following directory structure:

Step 2: Select the Appropriate Version

The beta 1 distribution provides binaries for the 3.5 and 4.0 versions of the .Net framework. Select the appropriate folder for your version from the following:

Step 3: Sanity Check

Before installing Quartz.Net 2 as a service, let’s check that everything is working properly. I’m running version 4.0 of the framework so I will open a command prompt as Administrator in the 4.0 folder. Note: If you don’t open the command prompt as administrator, you will get no error messages or UAC prompts. The installation will simply fail.
Now that we have a command prompt, let’s try starting the Quartz.Net server. To do this, simply run Quartz.Server.exe by typing it into the command prompt.
If nothing happens, then you probably forgot to unblock the files you downloaded. Go back to Step 1 and start over. If everything is well, you will see some output in the command prompt. This means Quartz.Net is running and that the sample job that is configured out of the box is running correctly.
You may also get a firewall warning window, similar to this one:
This is because by default the scheduler exposes a remoting interface that allows you to interact with it. If you wish to enable access to remoting, then go ahead and click allow access. otherwise, click cancel. You’ll have to configure the firewall manually later if you wish to enable remoting access on the scheduler.
Press CTRL-C to stop the scheduler.

Step 4: Installing the Service

At this point you should be quite confident that the base distribution will work once installed as a windows service. Now it’s time to install the service. To do this, type Quartz.Server.exe install in the command prompt. If all goes well, you should see the following in your command prompt.
Now type services.msc in the command prompt to open the services administration window. There you should see the quartz service installed as “Quartz Server” with automatic startup and running under the Local System account. 
You should now be able to start and stop the service through the administration window.