Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 10 Application Pool fall a sleep

Tags:

iis

iis-10

We have ASP.NET Core application used internally which are used during office hours and a batch that should be processed 3 AM every morning which is scheduled by HangFire like this:

RecurringJob.AddOrUpdate(
                () => MyBatch(),
                "0 0 3 1/1 *");

The problem is that the Application Pool goes to sleep and the batch isn’t processed if the site isn’t manually started (by going to the website usually).

I have searched SO and tampered with these settings in the Application Pool but with no success: enter image description here

Some sources that I used to modify the settings:

  • How to prevent/extend idleTimeout in IIS 7?
  • https://serverfault.com/questions/443065/how-do-i-prevent-iis-8-from-stopping-idle-asp-net-applications
  • IIS seems like to sleep until the next request

The Application Pool is used by a total of 7 applications (all being inactive during night when the batch should be processed). The used Application Pool uses .NET CLR Version 2.0. I'm using IIS version 10.0.17134.1.

How can I make the Application Pool stay active so the batch can be invoked regularly every morning?

like image 831
Westerlund.io Avatar asked Jul 15 '18 12:07

Westerlund.io


1 Answers

I ran into the same issue where my ASP.NET core application goes into idle even with "AlwaysRunning" as start mode for the app pool, "Preload Enabled" set to true for the site, and idle timeout set to 0. I got it to work by installing the Application Initialization module and setting the .NET CLR version to v4.0. Don't use the "No Managed Code" as that would prevent the Always Running from triggering the app start.

I wrote a blog post on this explaining in more details the steps I took to get the app to run continuously.

like image 181
Tai Bo Avatar answered Sep 26 '22 01:09

Tai Bo