'Quartz.net in API with .NET not working in azure after hosting but working in local

 public static void Start()
        {
            ISchedulerFactory schedFact = new StdSchedulerFactory();
            IScheduler scheduler = schedFact.GetScheduler().GetAwaiter().GetResult();
            scheduler.Start();

  IJobDetail nJob = JobBuilder.Create<NService>().Build();

     
            ITrigger nTrigger = TriggerBuilder
                .Create()
                .WithCronSchedule("0 0 11 ? * MON-FRI *")
                .Build();

         
            scheduler.ScheduleJob(nJob, nTrigger);

}

The above function is in a service and the function need to be triggered everyday at 11 o'clock. Then in the Global.asax.cs the function is called

Scheduler.Start();

This works perfectly in local IIS but when hosted in azure the function is not triggered.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source