Quartz.Net scheduler works locally but not on remote host

Posted by Glinkot on Stack Overflow See other posts from Stack Overflow or by Glinkot
Published on 2010-05-04T05:46:59Z Indexed on 2010/05/04 5:58 UTC
Read the original article Hit count: 327

Filed under:
|
|

Hi. I have a timed quartz.net job working fine on my dev machine, but once deployed to a remote server it is not triggering. I believe the job is scheduled ok, because if I postback, it tells me the job already exists (I normally check for postback however). The email code definitely works, as the 'button1_click' event sends emails successfully.

I understand I have full or medium trust on the remove server. My host says they don't apply restrictions that they know of which would affect it. Any other things I need to do to get it running?

        using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Quartz;
    using Quartz.Impl;
    using Quartz.Core;
    using Aspose.Network.Mail;
    using Aspose.Network;
    using Aspose.Network.Mime;
    using System.Text;

    namespace QuartzTestASP
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    ISchedulerFactory schedFact = new StdSchedulerFactory();
                    IScheduler sched = schedFact.GetScheduler();
                    JobDetail jobDetail = new JobDetail("testJob2", null, typeof(testJob));
                    //Trigger trigger = TriggerUtils.MakeMinutelyTrigger(1, 3);
                    Trigger trigger = TriggerUtils.MakeSecondlyTrigger(10, 5);
                    trigger.StartTimeUtc = DateTime.UtcNow;
                    trigger.Name = "TriggertheTest";
                    sched.Start();
                    sched.ScheduleJob(jobDetail, trigger);
                }

            }

            protected void Button1_Click1(object sender, EventArgs e)
            {
                myutil.sendEmail();
            }
        }

        class testJob : IStatefulJob
        {
            public testJob() { }

            public void Execute(JobExecutionContext context)
            {
                myutil.sendEmail();
            }

        }

        public static class myutil
        {
            public static void sendEmail()
            {
    // tested code lives here and works fine when called from elsewhere
            }


        }
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET