Most people change the setting such that idle time app pool shutdown is turned off.
Not something I would advise, while it is an option, it's also there for a purpose. But plus + for the settings pointer.
If your site is breaking, then you need to fix your faulty code, and that's that. If it crashes, check your pool for its state, and if its stopped, you need to start digging into why it stopped. See this
Knowledgebase - Host-it Internet Solutions
There is also a default upper limit of
29 hours before a restart. You'll want to change this to run forever.
Also, while it is a feature, It is also not something that should be tampered with to run
forever. As you search around and look into posts regarding the 29 hours limit, you will find that this was mostly done for one of few reasons, and that main reason; was to never trust that an app would run reliably for such long lengths of time error-free, and therefore this feature was added as a way to reset the application and free any possible leakages said application may endure or be the recipient cause of.
I'd advise breezing over the docs :
Periodic Restart Settings for Application Pool Recycling <periodicRestart> before making changes and know what you're doing first. Also note this post regarding EF memory leak and the advice therein from the site I dislike so much :
Memory leak when using Entity Framework Many people have reported large memory consumption in EF, another reason not to allow your app to run
forever without restarting.
This is just one of many memory leak posts I can fork out on this mapper
Memory Leak · Issue #13048 · aspnet/EntityFrameworkCore - But as usual, you'll disregard my post and push on to your next issue. And if you care about your application, you would do the right thing by your users and use something a little less complex and something more reliable. That's my two cents on all that.