0

Well i have a job whch runs inevery 30 minutes. Quartz.net code :

   ITrigger trigger = TriggerBuilder.Create()
                          .WithDailyTimeIntervalSchedule
                            (s =>
                               s.WithIntervalInMinutes(30)
                               .OnEveryDay()
                              .StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(0, 0))
                            )
                          .Build();

Hangfire code:

  RecurringJob.AddOrUpdate(() => DoSomething(), "*/30 * * * *");

Both methods work on local as excpected, but on production server if website is inactive for example 2-3 hours jobs not triggering anymore. But if i go to my website next job will trigger. Is there any solution? I've to change something on iis or is it possible to solve the problem with code?

1 Answers1

1

Every application pool has an idle timeout defined. If the timeout elapses and no requests are made to the application, IIS will stop the worker process and the application will be unloaded.

Since you set the frequency of your job to 30 minutes and the default idle timeout is 20 minutes, I strongly suspect this is your problem.

You can configure the idle timeout in IIS Manager:

  1. Open IIS Manager.
  2. In the Connections pane, expand the server node and click Application Pools.
  3. On the Application Pools page, select the application pool for which you want to specify idle time-out settings, and then click Advanced Settings in the Actions pane.
  4. In the Idle Time-out (minutes) box, type a number of minutes, and then click OK.
Albireo
  • 10,977
  • 13
  • 62
  • 96
  • Is it possible to change this settings only specific application and not globally? Because in application pool there are ASP.NET v4.0, DefaultAppPool and exc.. global terms – Nika Javakhishvili Dec 17 '15 at 11:19
  • The setting is per application pool ("ASP.NET v4.0", "DefaultAppPool" and such *are* application pools), not global. If you want a custom setting for your site you *must* create a dedicated application pool (if it already hasn't one). – Albireo Dec 17 '15 at 11:22
  • Read on what application pools are and how to manage them: [IIS Application Pool](https://technet.microsoft.com/en-us/library/cc735247(v=ws.10).aspx), [Managing Application Pools in IIS 7](https://technet.microsoft.com/en-us/library/cc753449(v=ws.10).aspx). – Albireo Dec 17 '15 at 11:24
  • But it doesn't overload the server? in my Application pool there are 77 websites and all has default application pool... I want to make changes only for one website – Nika Javakhishvili Dec 17 '15 at 11:25
  • 1
    @NikaJavakhishvili you can read about it at http://serverfault.com/q/2106. – Albireo Dec 17 '15 at 11:27
  • Ok i will create a new application pool. How to make it always runnable. I can write minutes but i want that it to be always runnable – Nika Javakhishvili Dec 17 '15 at 11:38