SBFrancies
SBFrancies

Reputation: 4230

Triggering startup of an ASP.Net Core app under IIS

I am running an ASP.Net Core 3.1 web application under IIS. It works as expected except for one thing. The application does not startup until an endpoint has been hit.

This is not a problem on the initial startup as I can just trigger an endpoint as part of the installation scripts. The problem is when there is a service interruption which causes the application to stop. My app pre-loads data on startup in order to improve performance (using IHostedService implementations) and this now does not happen until someone is actually trying to use the service.

I was wondering if there is either an IIS or ASP.Net setting I could use so that the application will automatically start up as soon as the IIS web site is running. The best I can think of at the moment is having a separate application poll a liveness endpoint.

Upvotes: 0

Views: 793

Answers (1)

Tom
Tom

Reputation: 745

If you are running IIS 7.5 or higher, this is doable by configuring both the app pool start mode and setting the app/site to preload. See this existing answer: https://stackoverflow.com/a/47199169/203172

Upvotes: 1

Related Questions