I have a Wep API .NET core application running through IIS on Windows Server 2016.
The app is doing a lot more than just replying to its API as it is monitoring events, etc on other services.
I have 3 problems:
When I start / restart the app through IIS (or when publishing an update), it doesn't do anything until there is a request coming. Then the app gets started. Is there a way to force the app to run immediately?
The app does a lot of background processing and I find that sometimes it stops doing anything at all. It has tasks on a timer that do not get executed, etc. If I constantly output work to the logger, this doesn't happen
When the app starts, it sends quite a few things to the log and during that time, I can see it start twice! It starts to display a page worth of log and then it starts again. But here is what's odd: when the app starts, there is a random 'cute name' selected so we can differentiate instances and during the original and the second startup it is the same name, so it shows that it is the same instance, but the init gets called a second time.
Is there something specific about the way apps run in an IIS container that could explain these behaviors?
After doing more search, the recommended option is to run as a service, but it's not a possibility in my case, so I still need to make a .Net Core Kestrel app with IIS as a reverse proxy.
And despite the comment below, I still don't find any good solution short of pinging the site regularly to keep it alive.