IIS 7 and Above
How can I make all applications display an offline message?
Last post Oct 12, 2017 06:08 AM by Yuk Ding
Oct 11, 2017 10:18 AM|HC4u|LINK
I'm aware that placing app_offline.htm in the root of each application will serve an offline message when any URL is accessed within that application.
I've got a lot of applications on a server. This approach would require making the change in each and every application and testing every one to ensure that they are offline. Then again we'd have to remove the file from every application and test to make
sure that they are all online.
Is there a way to simplify this by setting it at the IIS level?
Oct 11, 2017 09:49 PM|lextm|LINK
What kind of server are you managing? If you manage a multiple server load balancing system, it would be good to remove a server out, change all web apps, and put the server back. There is totally no need to use app_offline.htm. That feature should be of
no serious usage in an enterprise environment, but personal sites (which usually hosts on a single server).
Oct 12, 2017 06:08 AM|Yuk Ding|LINK
It depend on when do you want to display the message? The app_offline.htm is not a page that return message when you stop IIS. It also require user to leave the IIS site online. When you put app_offline under the root folder, it will only redirect all the request
to .aspx to specific folder. It is also not working with static file like html. IIS could not return message when IIS stop as well.
So if you need to let all the site to offline, you could create a URL rewrite global rule instead.
<rule name="return error" stopProcessing="true">
<match url="(.*)" />
<action type="CustomResponse" statusCode="511" subStatusCode="2" statusReason="updating" statusDescription="error message" />
You could just input the custom status code and the statsu description attribute is the content that you want to return.
Just remember to put it in applicationhost.config as global rule.
In addition, you could create a rule to redirect/rewrite all the request to specific URL when you want to get all the website offline.