I have ASP.NET Core API (v 2.2) running under IIS using Windows Hosting module that is shipped with .NET Core. I have configured Hangfire in startup.cs with couple of recurring jobs.
The API's app pool periodically gets recycled because of inactivity. However whenever app pool get recycled(for any reason) the recurring job stops running until the first user invoke the api.
Hangfire documentation has solution but it is specific to Full .NET and it may not work for .NET Core.
One of the solution i found is to run recurring jobs in console application but then i have to create and maintain one more application. Also, in addition to recurring jobs, API internally creates background jobs to make one way call. For example
[HttpPost]
public IActionResult DoWork(int id)
{
BackgroundJob.Enqueue<IWorkerService>(x => x.DoWork(id));
}
So if i create console application just for recurring jobs, i still have to configure Hangfire in API for background jobs. I am trying to avoid configuring Hangfire in two places.
What are my options in ASP.NET Core to make API always running?
UPDATE 1
based on discussion here i made the changes to App Pool settings
set Regular Time Interval
to 0
Change Idle Time-Out
from default 20 to 0
I will wait for few days to see how this settings works
However, i am not sure if its a good idea not to recycle app pool ever? Any suggestion