c# - Quartz.net Schedular working on local host but not working on shared hosting -
i using quartz scheduling tasks in web site project. jobs getting executed when run locally visual studio , when upload website on shared hosting doesn't work.
can 1 tell me reason behind ?
public class jobschedular { private static ischeduler scheduler = stdschedulerfactory.getdefaultscheduler(); public static void start() { 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 job class.
and how start job in global.asax
void application_start(object sender, eventargs e) { // code runs on application startup jobschedular.start(); }
can reason why not working on server after deployment ? how make run on server ?
you're losing reference scheduler. scheduler should long-lived object in application, singleton ideal.
however, there issues running quartz.net embedded in application because iis recycles applications , kill scheduler.
Comments
Post a Comment