I am using Quartz for scheduling tasks in my web site project. The jobs are getting executed when i run it locally from visual studio , but when i upload the website on shared hosting it doesn't work.

Can any one tell me what could be the reason behind this ?

public class JobSchedular
{
public static void Start()
{
    IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
    scheduler.Start();

    IJobDetail SendWeeklyMailJob = JobBuilder.Create<SendWeeklyMailJob>().Build();
    IJobDetail SendQuarterMailJob = JobBuilder.Create<SendQuarterlyMailJob>().Build();

    //ITrigger SendWeeklyMailJobTrigger = TriggerBuilder.Create()
    //    .WithIdentity("SendWeeklyMailJob", "SendWeeklyMailJobTrigger")
    //    .WithSchedule(CronScheduleBuilder
    //    .WeeklyOnDayAndHourAndMinute(DayOfWeek.Monday, 5, 15))
    //    .Build();

    ITrigger SendQuarterMailJobTrigger = TriggerBuilder.Create()
        .WithIdentity("SendQuarterMailJob", "group1")
        .StartNow()
        .WithDailyTimeIntervalSchedule(s => s.WithIntervalInHours(24))
        .Build();

    ITrigger SendWeeklyMailJobTrigger = TriggerBuilder.Create()
        .WithIdentity("SendWeeklyMailJob", "group1")
        .StartNow()
        .WithDailyTimeIntervalSchedule(s => s.WithIntervalInMinutes(1))
        .Build();

    scheduler.ScheduleJob(SendWeeklyMailJob, SendWeeklyMailJobTrigger);
    scheduler.ScheduleJob(SendQuarterMailJob, SendQuarterMailJobTrigger);

}

}

This is my job class.

And this is how i start that job in global.asax

 void Application_Start(object sender, EventArgs e)
{
    // Code that runs on application startup
    JobSchedular.Start(); 
}

Can i get the reason why it is not working on server after deployment ? how to make it run on server ?

Related posts

Recent Viewed