1

I am running a .NET Core web application on IIS which runs a web request every few minutes, this is working absolutely fine, the app checks the DB and if the time has already elapsed it does the web request running my task.

The issue I am having is that after some time, the app simply stops and I get a message on the event log with "application "Bla Bla Bla" has shutdown.

I've changed my application pool on IIS settings so it keeps itself alive, "StartMode: AlwaysRunning", "Idle time-out(minutes): 0" and "idle time-out action: Suspend".

Still, it seems to shut down every now and again.

What am I doing wrong?

enter image description here

keuleJ
  • 3,418
  • 4
  • 30
  • 51
APearTree
  • 51
  • 1
  • 8
  • Jus for reference **ISS** = International Space Station, **IIS** = Internet Information Services – TheGeneral Nov 11 '21 at 09:38
  • 1
    @TheGeneral But it would be way more impressive if it brought down the ISS – DavidG Nov 11 '21 at 09:44
  • @DavidG indeed, and exactly why NASA don't run their long running tasks on the IIS app pools – TheGeneral Nov 11 '21 at 09:55
  • Sorry, I was obviously thinking about something else. Thanks for editing @keuleJ. – APearTree Nov 11 '21 at 09:56
  • The Windows Event Log often gives clues for this type of issue. Is your app running [out of process](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/out-of-process-hosting?view=aspnetcore-6.0#out-of-process-hosting-model)? If so the idle timeout you see in the IIS settings [does not apply](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/advanced?view=aspnetcore-6.0#idle-timeout). – sellotape Nov 11 '21 at 11:01
  • No, it seems that it is just ignoring my settings. As the iHostedService is basically calling webpages, I've added it to call my / page every 30 minutes, but it seems that it still does not like it and shuts down the app. Very annoying. – APearTree Nov 12 '21 at 09:07

1 Answers1

2

May be Visit IHostedService Stop without any reason

Also,

IIS is not a proper way to release scheduler tasks. I advise you that you can use Windows Service.

Click here for further information.

CagriK
  • 121
  • 1
  • 7