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
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