I don't know how to use Quartz.dll in ASP.NET. Where to write the code for scheduling jobs to trigger mail every morning? Please if some body knows about it plz help me...
Edit: I found HOW TO use Quartz.NET in PRO way? to be really useful.
I don't know how to use Quartz.dll in ASP.NET. Where to write the code for scheduling jobs to trigger mail every morning? Please if some body knows about it plz help me...
Edit: I found HOW TO use Quartz.NET in PRO way? to be really useful.
A few weeks ago I wrote about using Quartz.Net to schedule jobs in Windows Azure Worker Roles. Since then I ran into a requirement that pushed me to create a wrapper around the Quartz.Net IScheduler. The JobSchedule has the responsibility of reading a schedule string from the CloudConfigurationManager and schedule a job.
The CloudConfigurationManager reads settings from the Role’s configuration file, which can be edited through the Windows Azure Management Portal under the configure section of your cloud services.
The following example will schedule a job which needs to be executed everyday at 6 AM, 8 AM, 10 AM, 12:30 PM and at 4:30 PM. The schedule is defined in the Role settings which can be edited through Visual Studio. To reach the Role settings, go to your Windows Azure Cloud Service project and find the desired Role configurations under the Role folder. Open the configuration editor by double clicking on the configuration file, then navigate to the ‘Settings’ tab. Click on ‘Add Setting’ and name the new setting ‘JobDailySchedule’ and set its value to 6:0;8:0;10:0;12:30;16:30;
Then using the JobSchedule schedule a daily job using the schedule defined in the Role’s configuration file.
The DailyJob implementation goes as follows. Since this is a demo, I will not add any specific logic to the job.
The JobSchedule wraps the Quartz.Net IScheduler. In a previous post I spoke about the importance of wrapping your 3rd party tools, this is an excellent example because I am containing the job scheduling logic and I could potentially change this logic without affecting the code that is using the JobSchedule.
The JobSchedule should be configured when the Role starts and the JobSchedule instance should be maintained throughout the Role’s lifetime. Changing the schedule can be achieved by changing the ‘JobDailySchedule’ setting through the Windows Azure Management Portal under the configure section of your cloud services. Then to apply the new schedule, restart the Role instance through the Windows Azure Management Portal under the instances section of your cloud services.
You have a couple of options, depending on what you want to do and how you want to set it up. For example, you can install a Quartz.Net server as a standalone windows serviceor you can also embed it inside your asp.net application.
If you want to run it embedded, then you can start the server from say your global.asax, like this (from the source code examples, example #12):
If you run it as a service, you would connect remotely to it like this (from example #12):
Once you have a reference to the scheduler (be it via remoting or because you have an embedded instance) you can schedule jobs like this:
Here's a link to some posts I wrote for people getting started with Quartz.Net: http://jvilalta.blogspot.com/2009/03/getting-started-with-quartznet-part-1.html