I am trying to come up with a way to deploy ASP.NET code with as little site disturbance as possible. One thought was to set up the site to be served from an NTFS junction c:\www\example.com where

c:\www\example.com -> c:\www\example.com_r1234

Then, when new code is deployed, it gets copied to c:\www\site.com_r1235 and the junction retargeted to

c:\www\example.com -> c:\www\example.com_r1235

So my question is what affect this might have on current requests in IIS? What other drawbacks might this have from the point of view of IIS's reaction to the change (if any)? Will this be as seamless for the end user of the site as I hope?

(I've considered changing the site's web root through the command line, but I really don't like the idea of reconfiguring IIS because of any unnecessary app domain or app pool churn that might happen, but I don't know a lot about what happens when the configured physical path of a site is changed while under load)

To be clear, my only concern here is the experience of my end users. My aim is to avoid disturbances for them, not convenience for me.

  • 1
    Reset the web root. Any recycling (don't think it would) and app pool restarts are then a) probably not "unnecessary", and b) help the worker process maintain a realistic idea about the state of its content and caches. It's a clever solution, sure, but clever rarely means stable. Find out what the majority of people do, then do that. – TristanK Sep 5 '11 at 9:46
  • That's a great question, I've been looking for an answer to that for a long time. All I've ever seen is either a rolling deployment under a load balancer (which I don't have) or a simple copy/svn of files into the webroot (which I don't like). – jayrdub Sep 5 '11 at 18:46
  • 1
    So, try retargeting the web root first. – TristanK Sep 5 '11 at 23:10

a way to deploy ASP.NET code with as little site disturbance as possible.

It seems like this objective and your proposed solution are not aligned, because you now have a bunch of extra work or scripts involved for every deployment.

One thing I have seen is to install an svn client on the production server, and the production site is a checked-out copy of a specific location/branch on the source control tree. This way at least you only have to update changed files for new deployments.

| improve this answer | |
  • That network operation would cause the site's artifacts to be in a state of ambiguity far too long. That's the exact situation I'm trying to avoid. I'm trying to eliminate the time where assemblies under the webroot are of different versions. – jayrdub Sep 1 '11 at 23:21
  • 1
    The "extra work and scripts involved" is not a concern, we are fully automated – jayrdub Sep 1 '11 at 23:23
  • I guess to be fair, disturbance and work required aren't really the same thing – Mark Henderson Sep 1 '11 at 23:50
  • Disturbance of the end user of my site is what I'm referring to – jayrdub Sep 2 '11 at 0:59

I created a folder behind my web root called _images


then copied a bunch of gif files into it. I then created an NTFS symbolic link on my root using

C:\DEV\PROJECT\ROOT mklink /D webimages ..\_images

In Visual studio 2010 I "Show All Files" then refresh... and include the new "webimages" into my project. I can now point to...

img src='webimages/icon.gif'

When I run the app it works fine too on my local machine.

I wont know if it works on the real server (IIS 7) until infrastructure gets a handle on this, does anyone know any issues on why this wouldn't work in production??

I feel as long as the rights are there it should, and if so what a great way to simplify sharing folders (of all types) between web apps.

I have not tried to express this in TFS yet, so if anyone has feedback on this let us know!

| improve this answer | |

This won't work because IIS may think the web.config has changed by another program. IIS will probably throw a System.Configuration.ConfigurationErrorsException exception. I would suggest writing some sort of script to just change the home directory of the site.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.