Some history...
For some time now I've been using VS2010 with TFS developing a web site which I work on using multiple workspaces; for example, workspace DEV1 might have code for a partially implemented new feature, so I'll fire up a 2nd instance of VS2010 and open the same solution in workspace DEV2 to fix a bug.
Within the solution file, the port number is fixed so that if I open one instance in any workspace the URL for testing starts http://localhost:8251/Core/...
. If I opened a 2nd copy, then VS2010 detected the first instance, checked out the solution file and assigned a random port number. Hence the URL might now start http://localhost:12345/Core/...
. Obviously, the port number was unimportant most of the time, but it's convenient to have it fixed for testing.
All worked well under VS2010 using its 'internal' webserver (Cassini). I could open multiple instances of VS2010 using solutions in difference workspaces and there was never any 'cross activation' where opening a page in one instance accessed files from a different workspace.
...End of history.
We're now moving to VS2013 and the 'internal' webserver has been removed so IISExpress has to be used for testing. The question is how to configure it so that it works for multiple TFS workspaces where the port number may be dynamically assigned.
The first thing noticed is that the stored startup page "Default.aspx?param=..." doesn't work right and IISExpress under VS2013 then tries to open http://localhost:8251/Default.aspx...
omitting the project name. So after an initial failure, I need to enter a new URL. Clearly, once we fully migrate to VS2013 from VS2010, I can change the startup page to "Core/Default.aspx..." and all should be well.
I've also been told that I can configure the file "IISExpress/applicationhost.config" in my Documents (?) folder to include the lines similar to...
<site name="Core" id="3"> <application path="/" applicationPool="Clr4ClassicAppPool"> <virtualDirectory path="/" physicalPath="C:\Working\DEV1\Core" /> </application> <application path="/Core" applicationPool="Clr4ClassicAppPool"> <virtualDirectory path="/" physicalPath="C:\Working\DEV1\Core" /> </application> <bindings> <binding protocol="http" bindingInformation="*:8251:localhost" /> </bindings> </site>
This seems to work for the first workspace, but it's not clear how to extend it for multiple workspaces, especially given that the port number will be dynamically assigned for the 2nd, 3rd, etc solutions. Simply duplicating the above for DEV2, DEV3, etc, suffixing the site name and changing the id as neeeded, seemed to work initially, but further investigation indicates that IISExpress actually uses the DEV1 workspace! I.e. it's using the first matching application. Do I have to name the sites individually by workspace? Do I have to hardcode the port number for each instance? How do |I then refer to each one? It all seems to me to be a complete mess after the simplicity of VS2010's handling of multiple workspaces!
In short, what I want is the be able to open one or more instances of VS2013 using multiple workspaces referencing the same solution and be able to run multiple copies of the application side-by-side, possibly using dynamically assigned port numbers, and know that each instance is using its own folders. If there's only one instance open, it should use the default port number, but it that's already in use, it should just assigned a random port, and not interfere with the other solution.
Additionally, while testing, it seems that something rewrites this file. Is this normal, since once I have a configuration which works, I don't want it altered! [Update: it seems I'm not the only one with this concern as others have asked about this here! However, there doesn't seem to be a solution given which works.]
It would be so much simpler if MS hadn't removed Cassini... :SIGH:
Update: Seems this was difficult in VS2012 as well as other have a similar problem!