5

I'm just looking for some advice/best practice for this situation:

We have a solution with a couple of web sites in it (one is a web site project, the other is a web application project). We have both of these sites set up to use our installed IIS (v7), as we have other projects that we need to access these via localhost whilst debugging.

We've just moved to TFS (from GIT) - when we switch branches, I have to go and 'repoint' my virtual directories under IIS to point at the new branch, which is a bit of a nuisance. Does anybody have any advice/guidance as to what is the best way to approach this? I would note that I don't think that switching to using Cassini will suit our situation.

asked May 5, 2011 at 8:43

5 Answers 5

3

IIS Express might be an option. This article is about IIS Express with SSL but also can give you some idea's on how to configure for your problem.

Remember that IIS Express is really IIS. It's just "local personal not-a-service" IIS. That means that IISExpress puts its config files in C:\Users\YOU\Documents\IISExpress\config rather than in some machine-wide location.

My project is called "MvcApplication18" so I can open up my ApplicationHost.config and look for "MvcApplication18." You can too. There's my site, right there, in IISExpress's applicationHost.config:

<site name="MvcApplication18" id="39">
 <application path="/" applicationPool="Clr4IntegratedAppPool">
 <virtualDirectory path="/" physicalPath="c:\users\scottha\documents\visual studio 2010\Projects\MvcApplication18\MvcApplication18" />
 </application>
 <bindings>
 <binding protocol="http" bindingInformation="*:15408:localhost" />
 </bindings>
</site>

An other option might be to script the repointing of the virtual directories and call it where you think is appropriate (pre build step, separate script) MSBuild extensions could get you started in that direction.

Hope this helps.

answered May 5, 2011 at 8:53
3

I solve this by having multiple web applications defined in IIS and then save the new URL in the branched project (as most of IIS's configuration is in the web.config there is little else to do).

This also has the benefit of being able to operate with both in parallel (eg. comparing last checkpoint/release to current side by side).

answered May 5, 2011 at 9:10
1

One of my colleagues had the bright idea of specifying the path in IIS using an environment variable - we then have a simple script to run when we switch branches to update that variable and 'tada' all our sites are pointing to the right place...

answered May 5, 2011 at 12:49
0

Actually switching to Cassini or IIS Express is a solution. IIS has no knowledge about TFS or branches so you must reconfigure it each time you do the switch (either manually or by manual execution of some script).

answered May 5, 2011 at 8:54
0

One method might be to use in place branch switching. Instead of mapping each branch to a seperate folder, instead remap your second branch into the same folder as the previous when switching. A good blog post on this approach is from Richard Banks at http://www.richard-banks.org/2011/03/how-to-in-place-branch-switching-with.html

answered May 6, 2011 at 2:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.