The (short) Problem We need to run the same website code, with a different web.config, on the same server.

The (Slightly longer) Problem The site needs to be hosted on 2 different domains, both on SSL, therefore, we need to have 2 different websites, on different IPs. However, we would like the codebase to be consistent for both of them, so when 1 get's updated, the other one is done at the same time. We also need to make each website use it different web.config (as there are values that are specific to each of the sites.

So, what we want really, is some way to define the location of the web.config for a .NET 4.0 aspx site from within the IIS configuration.

It's IIS 6.0 at the moment, but if IIS 7.0/7.5 will solve the issue then an upgrade is potentially an option.

Things I've thought of: Using symbolic links for all the folders and files other than the config. I'm not sure this is the best option as other files/directories could be added at some point and would be forgotten at deployment time. Synchronising the folders. This would mean that we're relying on a process to keep them upto date, either in real time or on a schedule. it's also a lot of overhead.


Assuming IIS doesn't have an inbuilt method of doing this (for example, you've confirmed that <location> tags in applicationhost.config don't support the settings you want), your question becomes one of straight file management.

I'd suggest abandoning the complicated (symlink-based) solutions you're considering which future admins may not expect or understand, and going with a simple, easily understood copy of all files, only with a different web.config.

Copy everything from directory A, but exclude the web.config file (eg, using ROBOCOPY with /XF)

Then you just need to ensure the web.config file doesn't drift significantly between copies, but that's more of the same.

  • I think the issue with this solution (if I'm understanding it correctly) is that there would need to be a manual action to copy the files on each deployment, which is the exact solution I didn't want to do. – Martin Jan 31 '12 at 16:35
  • You're doing the original deployment without copying files!? That's crazy! :) – TristanK Jan 31 '12 at 21:05
  • That was the plan, but it's looking less likely. We're probably going to go down the route of getting the application changed to allow for inbound hostname dependent configurations. This way, there is no need to copy/link files, it's just 2 websites using the same codebase location – Martin Feb 9 '12 at 0:02

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.