Learn how to use Asp .Net Core’s framework feature or code your own implementation

How To Implement A “Maintenance Mode” in ASP.NET Core

Edwin Klesman
4 min readApr 7, 2023
A tutorial with code examples showing you how to use ASP.Net Core’s “App Offline file” method for easy maintenance mode, and how to implement your own maintenance mode for those scenarios where you want to have more control or add actions (i.e.: logging or informing people) to the maintenance mode.

In this article, you will both learn how to put your asp.Net Core app into maintenance mode using the framework’s “App offline file” feature, and how to implement your own maintenance mode logic when you need more control.

Let’s start with the fast solution when you just need to put it in maintenance quickly.

Using the framework’s maintenance feature

For a fast implementation, you can use asp .Net Core’s maintenance feature by adding a file called “app_offline.htm” in the root of your solution. This is a very nice, quick and easy solution that lets you create a HTM(L) file with the layout and message that you want to show to your users you are performing maintenance on the app.

This feature is called the “App offline file”, and has some things to consider, like:

  • the file can be maximally 4Gb in size (should be more than enough)
  • it needs your app to receive another request to become online after removing the file
  • in specific situations, the app might not shut down immediately

--

--

Edwin Klesman

Senior dev @Detacom | cross-platform mobile & web dev | Product Maker | SaaS | from app ideas to implementation | Owner eekayonline.com | Music: edsonkailes.com