Click here to Skip to main content
11,926,933 members (49,770 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET C#4.0

I need to shut down my web application during maintenance process, have already gone through many ways like putting app_offline.htm in root directory , disabling the Runtime or disabling it manually via server but i what i need to implement is to do this process completely automated.

What i have is the start and end dates for shut down and flag for those days i.e whether application needed to be shut down on those dates.

Solution that i already have is to create a job in sql server agent which creates and deletes the app_offline.htm file in and from the root directory but what the problem is i need to give static path for the root directory of my application which i don not want to do.

Any help would be much appreciated.
Posted 4-Jun-13 10:20am
Maybe an interesting question, but... Did you think about keeping consistency on atomic level? It would allow just to kill the service at anytime without much harm.
Ariana Bond 4-Jun-13 15:37pm
This comment of yours is worthless without an answer.
richcb 4-Jun-13 15:40pm
You will not last long here if you speak to people this way. Consider this a warning.
Ariana Bond 4-Jun-13 15:41pm
Thanks for the warning...
This is just the opinion of the OP. No need to make a big deal out of it.
Ariana Bond 4-Jun-13 15:45pm
Thank you SA...
It's up to you how you use my comment. If you simply told me what you want me to do, I would think about posting an answer. For example, do you need a clarification? Or don't understand it? Or would need some detail? Or think that my idea is wrong? You are welcome to discuss it if you want.

To get help, you need to be more collaborative, I think so. Not a problem at all though...

Ariana Bond 4-Jun-13 15:49pm
Was quite frustrated with this topic that is why misbehaved with you. And i am truly sorry for that.
Thank you for this note. Really, no problem. We're good.
Zoltán Zörgő 4-Jun-13 15:41pm
Sergey's suggestion is usable, but not all application logic let you do that.
I would address in two steps:
1) Pre-maintanance phase: allow continuation of open sessions, but disallow new sessions. Plus a warning for the online users about application shutdown. You still need to run and you need some modification in your code.
2) After all sessions are closed or a grace period expires, you can shut down web application gracefully via the management interfaces.
Ariana Bond 4-Jun-13 15:42pm
This is appreciable.
I agree. That's why my comment was in the "Did you think about...?" form.

This is exactly the point: this is the architectural-level decision which should depend on main functionality of the Web site (not the other way around, of course). Your scheme is quite a valid one for some other cases, more complicated. And my variant would probably be one of the simplest...

artefakt94 10-Jun-13 10:38am
You can create a base page class with a function which manage this maintenance mode.
In this base class, you can get the current date and check in database if the app must be forced in maintenance mode. If so, you can redirect to a maintenance page you have developed.
Then, you add pages of your website that inherit this base class.
I think you can do the job with this ;)
Don't hesitate if you need additional explanations or help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 4 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100