locked
How can I make all applications display an offline message? RRS feed

  • Question

  • User-1367089028 posted

    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?

    Wednesday, October 11, 2017 10:18 AM

All replies

  • User690216013 posted

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

    Wednesday, October 11, 2017 9:49 PM
  • User-460007017 posted

    Hi HC4u,

    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" />
                    </rule>

    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.

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

    Best Regards,

    Yuk Ding

    Thursday, October 12, 2017 6:08 AM