VS 2012 launching app based on wrong path

前端 未结 7 1212
予麋鹿
予麋鹿 2020-12-25 13:33

I have a app which is under source control (TFS 2012 also) on c:\\Dev\\MyApp\\Main.

Because im developing a new feature I decided to open a branch on c:\\Dev\\MyApp\

7条回答
  •  囚心锁ツ
    2020-12-25 14:04

    When you open a Visual Studio solution that contains an IISExpress web project, the applicationHost.config element configuration is updated. If you then open a solution for a separate branch, it's possible that the configuration will be overwritten to point to that separate branch.

    For example, let's say you have two branches of a solution containing a web project configured to use IISExpress on port 4000. When you open the solution for Branch1, the applicationHost.config will be updated with a element registering a site at localhost:4000 pointing to the folder for Branch1. When you 'Start Debugging' your solution, your browser opens localhost:4000 and everything works just fine.

    If you then open the solution for Branch2, the applicationHost.config will be modified again, overriding the element so that localhost:4000 now instead points at Branch2. Now, if you 'Start Debugging' in either the open Branch1 solution or the open Branch2 solution, localhost:4000 will be pointing to Branch2, since that's what's in the applicationHost.config file.

    To work around this issue, configure the two branches to use different ports and then Visual Studio will manage two separate applicationHost.config elements, one for each branch. You'll need to remember to configure a new port number each time you create a new branch.

提交回复
热议问题