Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for updating a live website running on IIS

Currently, when we have updates that we want to roll out to our live website, we run a .bat file that copies the entire folder structure up from our development environment to the live servers. This replaces the folder that the virtual directory points to with the new updated new one. This is done while the server and IIS are live and obviously while users are accessing the website.

We occasionally get errors that are caused by files or folders becoming 'locked' immediately after an update, and usually the only option is to stop IIS or reboot the server. We're guessing that this 'locking' is caused by the .bat file attempting to overwrite a file while it is in use by IIS.

Has anybody else experienced this and/or what would you recommend as the best way to update a live website on the fly with minimal downtime (i.e. almost no downtime at all).

Thanks.

like image 637
Martyn Avatar asked May 20 '11 11:05

Martyn


People also ask

How do I publish my website on IIS?

In IIS, right-click the Default Web Site, choose Deploy > Configure Web Deploy Publishing. If you don't see the Deploy menu, see the preceding section to verify that Web Deploy is running. In the Configure Web Deploy Publishing dialog box, examine the settings. Click Setup.

How do I know if Web Deployment Agent is running?

To check that the Web Deployment Agent Service is running On the Start menu, point to Administrative Tools, and then click Services. Locate the Web Deployment Agent Service row, and verify that the Status is set to Started.


2 Answers

Reposted as an answer rather than a comment, was having a stupid moment there!

If you can't have downtime, then the best thing is to have another copy of the server running that you can divert users to when you want to update the primary. Then you divert your users back to the primary after the update.

You can use the State Server sitting on another server to ensure that any session state is maintained when they switch from one to the other.

We are currently experimenting with Microsoft's Web Farm Framework, which seems to do this kind of thing very well.

Our setup involves a front end server, a primary and secondary web server, and a separate state server. WFF keeps copies of web apps in sync on both machines and state server ensures that if a user switches servers between requests (or their current server goes offline), that they should not notice the change.

To upgrade the primary, take it out of load-balancing which will divert all of it's requests to the secondary server. Do your upgrade, put it back in to rotation, and then repeat the process with the second server.

like image 145
hermiod Avatar answered Nov 15 '22 16:11

hermiod


Buy a second webserver, buy a load balancer. Mark 1 server offline, upgrade, bring back online. Mark server 2 offline, upgrade, bring back online.

like image 38
Jan Jongboom Avatar answered Nov 15 '22 16:11

Jan Jongboom