views:

24

answers:

1

I have an asp.net website in my production server which running fine now. Now I am using quartz.net for scheduled tasks and in my development system I have tested it. I want to move it to production server.

My global.asax at present in production server:

void Application_Start(object sender, EventArgs e)
{
    Application["Hits"] = 0;
    Application["Sessions"] = 0;
    Application["TerminatedSessions"] = 0;
    ConfigureLogging();
}

and I am going to change it to

void Application_Start(object sender, EventArgs e)
{
    ISchedulerFactory schedFact = new StdSchedulerFactory();
    // get a scheduler
    IScheduler sched = schedFact.GetScheduler();
    sched.Start();
    // construct job info
    JobDetail jobDetail = new JobDetail("mysSendMailJob", typeof(ScheduledMail));
    // fire every day at 06:00
    Trigger trigger = TriggerUtils.MakeDailyTrigger(06, 00);
    SimpleTrigger trigger2 = new SimpleTrigger("myTrigger",
                            null,
                            DateTime.UtcNow,
                            null,
                            SimpleTrigger.RepeatIndefinitely,
                            TimeSpan.FromSeconds(60));
    // start on the next even hour
    trigger.StartTimeUtc = TriggerUtils.GetEvenHourDate(DateTime.UtcNow);  
    trigger.Name = "mySendMailTrigger";
    // schedule the job for execution
    sched.ScheduleJob(jobDetail, trigger2);
    // Code that runs on application startup
    Application["Hits"] = 0;
    Application["Sessions"] = 0;
    Application["TerminatedSessions"] = 0;
    ConfigureLogging();    
}

Will these changes be updated or what will happen?

+2  A: 

If it is not precompiled then you can have a different file on the server.

If it is precompiled you can't change it on the server. To fix this you an use compilation symbols to have different application_start methods or have setting that defines which method to call.

If you are using .Net 4 you can have a debug and release web.config file you you could set some sort of condition in there and check for it when the app spins up.

Sruly
@Sruly it is not a precompiled one, so if i replace the file my changes ll be updated right.
Pandiya Chendur
It should. You may have to recycle the app to get it reload.
Sruly