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).
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...
Is there anyway to let VS2012 perform the same check as VS2010?
Or am I doing/understanding something else completely wrong?
In the Connections pane, expand the server name, expand Sites, expand the Web site to which you want to add the virtual directory, and then click the application to which you want to add the virtual directory. In the Actions pane, click View Virtual Directories, and then click Add Virtual Directory...
Creating a virtual directory in IIS Express To create a Virtual Directory in IIS Express simple navigate to the IIS Express' config directory located in _C:\Users<User>\Documents\IISExpress\config_ and open the applicationhost. config file.
The entire IIS configuration for IIS6 is in c:\windows\system32\inetsrv\metabase.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With