locked
Quartz.net scheduler doesn't fire jobs/triggers once pulished RRS feed

  • Question

  • User-1874830633 posted

    I used Quartz.net scheduler in a ASP MVC application that send mail once a day. This scheduler fire only on debugging my app. When I publish this application on IIS the scheduler doesn't fire.

    global.asax

    public class MvcApplication : System.Web.HttpApplication
        {
            protected void Application_Start()
            {
                AreaRegistration.RegisterAllAreas();
                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
                AuthConfig.RegisterAuth();
                JobScheduler.Start();
            }
        }

    JobScheduler.cs

    public class JobScheduler
    {
    
        public static void Start()
        {
        IScheduler Scheduler = StdSchedulerFactory.GetDefaultScheduler();
        Scheduler.Start();
        IJobDetail job = JobBuilder.Create<EmailJob>().Build();
        ITrigger trigger = TriggerBuilder.Create()
            .WithDailyTimeIntervalSchedule
                (s =>
                s.WithIntervalInHours(24)
                .OnEveryDay()
                .StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(9, 44))
                )
                .Build();
            MvcApplication.Scheduler.ScheduleJob(job, trigger);
        }
    }

    EmailJob.cs

    public class EmailJob : IJob
        {
            public void Execute(IJobExecutionContext context)
            {
                //instructions for sending mails
            }
        }
    Monday, November 16, 2015 4:47 AM

All replies