ASP.NET Application Daytime Release
We have an Intranet with about 300 users whom actively use it thoroughly during the day. We need to be able to release a precompiled version of the application during the day as users usually give us incorrect requirements and开发者_如何学运维 then need it that day. At the moment we release a non-precompiled version and let the web server compile individual code-behind pages. The problem is when we release things like App_Code, it hits the server big style.
Is it possible to release DLL's during the day without screwing up someone's actions on a web page?
I'm going to second the "Get a second machine" sentiment, but I'm also going to offer a dodgy alternative.
You could always set up the website twice on the same machine. Assign 2 IP addresses to the machine and then assign one to each website. Finally set up load balancing across those two websites. This should allow you to direct user first to one site and then the other. I haven't tested this but I can't think of a reason that it wouldn't work.
I disagree on the need for a second server to just a v. small downtime. Sure if you want No downtime you need the second server, but ...
what causes the big downtime + any issues you might be seeing is any stuff you have in there that depends on the app not restarting. AFAIK you can't prevent it from restarting when u change those, but you Can avoid the secondary effects that cause the extra downtimes or errors for the users.
Consider:
- Not using in-process session Or use in such a way that almost if not all of your site doesn't depend on having the stuff in there i.e. if you load some stuff that u can reload, u can do so afterwards
- Avoid having stuff that causes the app to be very load when starting i.e. static loading / or stuff that's loading at application_start
- Have a fixed machine key, since if not it will change with the app restart and all sort of stuff become invalid i.e. auth tokens, viewstate, etc
Update 1: Note that the items you have to do to reduce the "downtime" to seconds, its the same and/or relates to what you would have to do to use 2 servers.
So, just for that I would do that first, and if what you said in a comment isn't an overstatement and each minute (say 3 20 secs deployments) will lose you hundrens of pounds, I would add that second server.
Note that the reason for taking the app offline costing you hundreds of pounds might not be just the downtime, but all the lost sessions, forms submitted (viewstate), authentication invalidated, etc ... getting read of that - depending on how you do stuff, just gets the user a longer wait time when submitting something ... and if it didn't go through, they can re-submit and it will go through.
Do you have more than one server hosting the site? If so you can take down one, update it, then put it back online. Take down the second, update, etc..
Or if you only have one, and if this process only takes a few minutes, which it should, just post an app_offline.htm file saying "the site will be back in 2 minutes".
In a single server environment like the one you are describing, then nope. You are going to have to wait until end of day to do deployments. Use this particular scenario to convince the powers that be at your organization that a second server is needed to do mid day updates and help mitigate downtime.
精彩评论