Deploying new version of an application to IIS Application without downtime

I have a small AngularJS web application that runs in kiosks in an intranet network. I’ve been tasked to make deployments without downtime and in an automated way that can be controlled remotely with a web interface. Since it’s a small application, we do not have load balancers or similar setups. I’ve looked at two options,

Option 1:
Download versions of the application in a folder and change the Virtual Directory’s Physical Path to the folder path of a new version, this is achievable using Microsoft.Web.Administration library with the following code,

            ServerManager sm = new ServerManager();
            Site site = sm.Sites["Default Web Site"];            
            site.Applications[virtualDirectory].VirtualDirectories["/"].PhysicalPath = newPath;
            sm.CommitChanges();

In this approach,

  1. How quickly will the switch be reflected?
  2. What are the chances that some of the kiosks still working with the older version of the application?
  3. Is there any chance for a downtime in between the short period of time the switch is made?
  4. Will any requests made to IIS in this period time return errors?

Option 2: Using IIS’ URL Rewrite feature. Basically I’ll be programmatically adding new rewrite rules to the application’s web.config to redirect to a different subfolder which will be the newer version of the application.

In this approach,

  1. How quickly will the URL rewrite rule reflect and the rewrite begin?
  2. What are the chances that some of the kiosks still working with the older version of the application
  3. Is there any chance for a downtime in between the period of time when the rewrite rule is added to the web.config?
  4. Will any requests made to IIS in this period time return errors?
  5. Will there be any performance cost for the URL rewrite?

Kindly help me out. Are both of these approaches not suited for my task? Are there any other alternatives to this requirement?

Answer

MSDeploy should be able to handle the automated and remote deployment part. If you don’t have another server or another way to send application traffic to a different virtual directory in an automated fashion, no downtime is not a practical request. It’s like saying I have 1 car, but I want to be able to keep driving it while it is in the shop. If you want a car to drive while your car is in the shop, you’ll need another car, temporary or otherwise.

Attribution
Source : Link , Question Author : user1890098 , Answer Author : DubStep

Leave a Comment