简体   繁体   中英

Best way to put a ASP.NET website version into production (IIS)

What are the best way to put a website into production to minimize the downtime due to initial compilation and initialization?

I don't like the IIS 8 application initalization module because (to my understanding) it needs to change machine specific configurations (applicationHost.config), which I'm not able (and hate anyway) to do.

How big .net website proceed to put into production? Is there a ideal solution where the old version isn't disabled until the new version is fully up and ready to replace the old version.

You need a cluster of two, can be set up with the ARR or NLB.

Having two nodes of the cluster, you just disable one so that all the traffic goes to the other.

Then you update the site on the disabled server and warm it up. And then you just switch active nodes in the cluster so that all new requests start to hit the updated server instantly.

Then you silently disable the other one, upgrade, warm up and enable in the cluster. The downtime is zero. Also, having at least two nodes in a cluster is a basic way to support the failover scenario and should be considered a must-have for a reliable website.

If you don't want to use a NLB or external load balancing service (which is best practice!) You you could probably get away with using ARR+ Re-write rules and multiple sites. I don't advise this it's kind of hacky

For example assume you have 1 IIS server and an application called guestbook that lives at guestbook.com The current version in prod is 5 and you are ready to deploy 6

On the server have 3 sites Created. Only 80 and 443 should be open to the world

  1. ARR_SITE listening on 80/443 with a binding of guestbook.com - this is where you will hang your re-write rules off of
  2. Guestbook V5 listens on port 8080 with a binding of localhost/127.0.0.1
  3. Guestbook V6 listens on port 1010 with a binding of localhost/127.0.0.1

On the ARR_SITE create a URL_Rewrite rule that will rewrite everything coming into guestbook.com:80/ to 127.0.0.1:8080 (Guestbook V5)

Deploy guestbook V6 as a new site port 1010 with a binding of localhost/127.0.0.1.

Access the new site once from a server that can reach it http://127.0.0.1:1010 . This will Initialize your site. At this point the real world can't access it because ARR is re-writing everything to V5

Now update your re-write rule to point to 127.0.0.1:1010(Guestbook V6)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM