15

My situation:
I am working on an ASP.NET MVC project and debug in IIS-Express. Sometimes when we create a temporary branch, this branch will use the same port for debugging. This means the virtual directory in IIS is the same and I can't run them both at the same time.

How it used to work in vs2010:
This is not really a problem because I don't want to run them at the same time. However, in VS2010, I would get a warning when opening the branch for the first time. It asked me if I wanted to remap the URL. When I later returned to open the trunk, I would get the same warning (See https://stackoverflow.com/a/3093534/210336). The message in vs2010

How it doesn't work in vs2012:
Now in VS2012, I don't get the warning anymore. If I forget to manually go to the settings and press "Create Virtual Directory" (This has happend a few times), then when I click run in the branch, it will actually run the trunk. This can be extremely confusing. Especially if I try to debug or the system breaks on an exception. A source file from the trunk will be opened in the branch solution. I then think I'm editting the branch, but I am in fact editting the trunk... The button in VS2012 that I need to press

Is there anyway to let VS2012 perform the same check as VS2010?

Or am I doing/understanding something else completely wrong?

Community
  • 1
  • 1
Matthijs Wessels
  • 6,530
  • 8
  • 60
  • 103
  • Curious - is there any difference in behavior if you run VS as administrator? – M Smearer Dec 12 '13 at 17:51
  • @RMK, not yet. We've moved to Azure, so I'm running through the emulator where I don't seem to have this problem. I did however find out that it works a bit different than I initially thought. Actually when you open a solution it maps everything (as if you press yes to all the prompts). So the last solution you openend will be the actual one instead of the first one where you mapped everything. – Matthijs Wessels Dec 18 '13 at 08:30
  • @MSmearer I always run as admin. I don't know how it works in vs2013. – Matthijs Wessels Dec 18 '13 at 08:30

1 Answers1

1

VS actually edits the IIS Express configuration file found in one of these paths

%userprofile%\documents\iisexpress\config\applicationhost.config
%userprofile%\my documents\iisexpress\config\applicationhost.config

When leaving it up to VS, I tend to see duplicated and conflicting configurations.

For local development, I prefer to start IIS Express from cmd or powershell script as it does not require attaching (but can be attached) and gives me control over the configuration. I make a copy of the iis config and specify the config file in the iis express command. I have a powershell script that sets the path based on the executing directory so no matter which branch, it is always set to the one I'm working in.

Here is some information about running iis express from the command line:

http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-from-the-command-line

And here is a good resource for running iis express from powershell:

https://blog.differentpla.net/post/UaYcAPDfiVJBAAAC/running-iis-express

crad
  • 433
  • 3
  • 6