How to put an asp.net application into offlince/maintenance mode?
Asked Answered
H

7

17

I've developed my first web application which, surprisingly, is getting very popular.

Because the website is now live, I have a hard time doing some changes, in fear some people are still logged in and are using the application.

I wish to avoid having a duplicated instance of the web application for testing.

Is there any way to put the website in 'maintenance mode' with only me having access to it? Like redirecting to a page with some info, telling its in maintenance mode.

Hedger answered 26/5, 2009 at 18:55 Comment(0)
U
9

This is the answer to your question: http://www.codeproject.com/Tips/219637/Put-the-website-in-Maintanance-Mode-Under-Construc

Unparliamentary answered 5/7, 2011 at 10:25 Comment(0)
B
31

I wish to avoid having a duplicated instance of the web application for testing.

That's your problem right there. For anything but the most trivial sites, you should have a staging or development instance. You should be using source control and have a script to update the main instance.

Biggs answered 26/5, 2009 at 18:59 Comment(4)
Very good point. Something I will have to consider that. This project really have got me into some different aspects. :-)Hedger
+1 @jskulski. I don't think this point can be stressed enough. You need to have at the very least a stage/UAT environment that matches your production environment as much as possible. Make your mistakes there instead of production. Even better to have a development environment and script your changes from there to Stage. That lets you catch the deployment bugs and allows for a smooth production rollout.Actiniform
This will be my solution, I better look into source control. Never been using it before. Thanks for pointing me in a new direction! If there is something I have to read about source control, I would be happy if you would share the information. :-)Hedger
Look into "Subversion" (also called SVN) and "TortoiseSVN".Toothpick
M
29

You can simply drop a file called app_offline.htm in the root of your website and ASP.NET will automatically route all traffic to this page. This file can contain any HTML you wish indicating that your site is down for a short period due to maintenance.

For more information please read App_Offline.htm and working around the "IE Friendly Errors" feature:

The way app_offline.htm works is that you place this file in the root of the application. When ASP.NET sees it, it will shut-down the app-domain for the application (and not restart it for requests) and instead send back the contents of the app_offline.htm file in response to all new dynamic requests for the application. When you are done updating the site, just delete the file and it will come back online.

Majunga answered 26/5, 2009 at 18:58 Comment(1)
link broken but this still works in .aspnetcore 8 . used this recentlyDaft
U
9

This is the answer to your question: http://www.codeproject.com/Tips/219637/Put-the-website-in-Maintanance-Mode-Under-Construc

Unparliamentary answered 5/7, 2011 at 10:25 Comment(0)
B
6

There's no such built-in functionality in ASP.NET except app_offline.htm which doesn't quite fit your needs because even you will be denied access to the site. You have to build it on your own but this is best done on the routers and load balancers level than at the application level. Of course this will depend on your network architecture.

Blithesome answered 26/5, 2009 at 18:59 Comment(0)
F
2

Besides building a dev replica of your website to build patches and fixes on, couldn't you just announce a site closing for maintenance several days in advance? I'm not a web programmer, but you might want look into what Hattrick, a popular online soccer management, does for maintaining their site. They use a notification system on the homepage, after users sign-in, that announces when maintenance will be taking place (usually late at night in Europe where a large portion of the players and all the devs are located) and they close down the website for a couple of hours. When they take the site down they post a page, using the same style as the rest of the site, and provide an estimate of when it will be up and running again. Simple, elegant, and when coupled with the long forewarning it seems to do a good job placating the user base.

Give users a long heads up that planned maintenance is scheduled to take place and give them some idea what it is for and most people will be able to accommodate the down time. Nothing is more frustrating than purposefully going to a web app that was up and running 10-20 minutes ago to find it suddenly unavailable and down for maintenance.

Froude answered 26/5, 2009 at 20:54 Comment(0)
G
1

Try app_offline.htm ??

Gavin answered 26/5, 2009 at 18:58 Comment(0)
F
0

What version of ASP.NET? I'm sure there are a million more elegant ways of doing this, but you can change the Default Document in IIS to redirect to Maint.html (or similar).

Founder answered 26/5, 2009 at 18:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.