How To Run Multiple .Net Website Versions Simultaneously

Modified on 2011/11/19 16:11 by Mark Categorized as dotNet, web
This entry describes how to seamlessly run multiple .Net websites simultanously in production, with a single version active for web users. Using this approach you can instantly switch between different versions, allowing for instant upgrade and rollback scenarios.

Problem Statement

Needing to run multiple versions of a website to allow for testing and instant upgrade and rollback while maintaining the appearance of running a single instance to the enduser.


Install website versions as a subdirectory under the website root and use a UrlRewrite rule to redirect requests to the currently active version.

Filesystem layout:
  web.config (Rewrite rules are defined here)
    web.config (version specific config)

Rewrite rule:
            <rule name="rewrite to active website">
               <match url="^(.*)$" />
               <action type="Rewrite" url="v1/{R:0}" />
                  <add input="{URL}" pattern="^/v[0-9]+?/.*" negate="true" />
                  <add input="{URL}" pattern="^/v[0-9]+$" negate="true" />

See also