21

I want to plan a schedule maintenance down time on one of my production asp.net website hosted on IIS windows server 2003.

I think this is the preferred behavior:

  1. All request to http://www.x.com including www.x.com/asb/asd/ will be redirected to a notification page (site is currently down. come back later)
  2. The maintenance will take around an hour. how do I ensure for having this redirection to maintenance page to have the least impact to SEO/google ranking
  3. Preferrably I want to be able to quietly test the production site before it goes back 'live'
  4. Preferrably I dont want to rely on pointing DNS elsewhere.
  5. To make it simple please pretend that I don't have any other hardware in front of the web servers (i.e load balancer, firewall etc)

An idea would be:

  1. to create another app on the same web server
  2. create httpmodule or httphandler to handle any url request and 302 redirect them to the maintenance page

Thanks

ronaldwidha
  • 1,345
  • 2
  • 12
  • 24
  • Possible duplicate of [Redirect site visitors during maintenance](https://stackoverflow.com/questions/1683199/redirect-site-visitors-during-maintenance) – jpaugh Jul 10 '18 at 19:05

2 Answers2

50

Try putting App_Offline.htm to the root directory.

Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288
  • 1
    @deviant 12 second was probably the amount of time it took you to get the link. upvote for that. thanks – ronaldwidha May 04 '09 at 08:07
  • @AntonGogolev What about a solution for MVC? Unfortunately it did not worked for MVC :( – Jack May 20 '16 at 08:01
  • @Clint Eastwood For me works for MVC without any problems – Yauhen.F Oct 26 '16 at 11:25
  • @Yauhen.F Did you try in a IIS Server? Does it working during a publish process continues? – Jack Nov 05 '16 at 08:55
  • How do I do it only for everyone but myself (identified by cookie, ip address or some other means)? Obviously I need to test the site after updating it. – John Mar 21 '17 at 08:30
  • @John - it's quite complicated but you could try this ... http://www.thereformedprogrammer.net/how-to-take-a-asp-net-mvc-web-site-down-for-maintenance/ – clayRay Jun 05 '17 at 23:11
  • @AntonGogolev - How does this address the 2nd point of the OP? Couldn't it could have devastating SEO effects for a well-ranking site? – clayRay Jun 05 '17 at 23:13
  • @clayRay A well-ranking site should be properly load-balanced and no deployment should take the entire site offline. – Anton Gogolev Jun 06 '17 at 11:55
  • @AntonGogolev a well-ranking site need not necessarily be a big money-earner. Small businesses or community groups would hardly to be able to afford the specialised expertise required to set up and maintain a load-balanced system. Also, very few Windows web hosts seem to offer load balancing so you'd probably need to be running your own server farm to be able to do this. – clayRay Jun 19 '17 at 05:44
  • @AntonGogolev - I forgot to add a prefix to that to say that "Yes, load-balancing would be ideal. But..." By the time I thought of it 7 minutes had passed so I was unable to edit my comment. – clayRay Jun 19 '17 at 06:00
  • I have an MVC app on Azure IIS and have realized app_offline.htm for MVC might not be the best option. I quickly used app_offline.htm but stylesheets, images, and script files that are referenced could break. For example, IE Edge forces the slash (/) after the end of the domain whereas google chrome does not include the slash. My references broke. For MVC, I think routes need to take charge and not the app_offline.htm – JoshYates1980 Mar 21 '18 at 13:43
6

copy an app_offline.htm file to the webroot

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

Chad Grant
  • 44,326
  • 9
  • 65
  • 80
  • Any solution for MVC please? Unfortunately it did not worked for MVC :( – Jack May 20 '16 at 08:02
  • @ChadGrant - How does this address the 2nd point of the OP? Couldn't it could have devastating SEO effects for a well-ranking site? – clayRay Jun 05 '17 at 23:15
  • 2
    @clayRay From [what I gather](https://yoast.com/http-503-site-maintenance-seo/), the 503 response returned by `App_Offline.htm` is well-understood by web-crawlers, and shouldn't impact SEO terribly much. – jpaugh Jul 10 '18 at 19:02