0

I had a strange experience running ASP.NET Core web application. Our company has two dotnetcore web applications. Currently both web app is rarely used. IHostedService is also used for both: https://www.stevejgordon.co.uk/asp-net-core-2-ihostedservice

Both web application is stopped running at some point and when the user visits the page via web browser everything is back to normal. The user is not experiencing any error. Does anyone know why it is stopping and starting? Probably the web app is in idle status and that's why it is not running. Any documentation would be useful.

Richárd Baldauf
  • 1,068
  • 2
  • 10
  • 24
  • 3
    If you're using IIS as a reverse proxy, ensure that your app pool is set to "Always Running" and not "On Demand". – Chris Pratt Oct 11 '18 at 13:03
  • you are absolutely right Chris! We were able to set IIS yesterday and it is always running. :) – Richárd Baldauf Oct 12 '18 at 06:46
  • crap, I'm speaking to early. This is still an issue but we have more information: yesterday we set this option on iis. It was running okay and one user visited the web app. Thanks for this visit the web app restarts, still no error. So, if the web app is running for 1-2 hour no user visits. It's in idle status. One of our users visits the page and baammm the web app is restarting. – Richárd Baldauf Oct 12 '18 at 07:04

1 Answers1

1

My teammate figured out what was the problem. You need to change the app pool on IIS, here are the steps:

Web server >> IIS Manager >> Application Pools >> PROS >> Advanced Settings... >> Process Model >> Idle Time-out (minutes): 0

We also set the recycle value to zero.

EDIT You can find more details here on this question: IHostedService Stop without any reason

Richárd Baldauf
  • 1,068
  • 2
  • 10
  • 24