How to auto start and keep an ASP.NET core web application running on IIS

Tai Bo
4 min readOct 7, 2018

I have an ASP.NET core web application which hosts a background task via the IHosedService interface. The task needs to run continuously to poll for messages on an azure queue storage every 5 seconds. I have learned the default settings on IIS do not start the application until it receives the first request. Additionally, if the application has not received a request after a predefined period of time, IIS kills the application.

I could have hosted the application as a Windows service or converted the application into a console application and use the Windows scheduler to have it run continuously. However, I find hosting on a real IIS server convenient and beneficial since we already have other applications running on IIS and we can access the application via HTTP.

In this post, I share the settings I use to make the ASP.NET core application to auto start and always run on IIS.

If you have an ASP.NET or an ASP.NET core which hosts a background job that needs to always run, want to preload the application for performance instead of waiting for the initial request to hit the app, or just get some tips on IIS, then read on.

Application does not auto start and goes into idle

The ASP.NET core module handles requests for an ASP.NET core application and manages the process under which the application runs. Per the documentation, the module does not start the…

--

--

Tai Bo
Tai Bo

Written by Tai Bo

Backend developer in .NET core. I enjoy the outdoor, hanging out with good friends, reading and personal development.