0

I currently have a web application that is running under a Virtual Directory plus under a default web site.

The team want to add a maintenance page if the application is under maintenance. I am not sure if this is possible as the application is under the directory of default web site in IIS 7.

Therefore, I am asking whether anyone can advise me whether it is possible to add a simple HTML page to the application which if it is unavailable the user can be directed to the static page.

Thanks

Andy5
  • 2,319
  • 11
  • 45
  • 91

2 Answers2

4

you need to create a html file and put on the root of the application folder. The name should be App_Offline.htm.

And when done with your work rename or remove this file.

IIS automatically recognize this page. And shows the same page for any request.

शेखर
  • 17,412
  • 13
  • 61
  • 117
  • Ah yes, this is a useful feature of ASP.NET, however it only works for ASP.NET applications and not entire websites. – Dai Feb 04 '14 at 11:45
  • +1 : That's good solution for asp.net websites. And whenever maintenance finishes, rename that file from **App_Offline.htm** to like **##App_Offline.htm**. – SpiderCode Feb 04 '14 at 11:56
  • 1
    One more thing I would like to add to this answer is that, user must have to create css in that htm page only. Because by putting this page into root folder whole site will go to offline and if user has put the css into app_theme for this page then it won't work. :) – SpiderCode Feb 04 '14 at 11:58
0

Create a second website in IIS with the same bindings, however it only contains the maintenance webpage. IIS doesn't let you run simultaneous websites with the same bindings, so press the Stop button on this secondary website.

When you want to perform maintenance, Stop the primary website (or if you want to keep it up for testing purposes, remove the public bindings) and Start the "maintenance" website.

I recommend using a URL Rewrite entry that returns your maintenance message with HTTP 500 for all requests (i.e. no redirections, no 404s, etc). That way all incoming users will see the message.

Dai
  • 141,631
  • 28
  • 261
  • 374
  • Thanks. However, I have asked the manager in charge whether the sites are gping to be moved out of the sub directory of default web site and have individual application. – Andy5 Feb 04 '14 at 11:52