简体   繁体   中英

Visual Studio 2012 Launches Wrong Project For Debugging

I've got an ASP.NET web application project in a Visual Studio 2012 solution. I'll refer to this as A.

I copied A's directory to a new directory to make a clone of it. I'll refer to this as B.

I made extensive changes to both A and B to the point that they are not even remotely similar. Stylesheets, scripts, HTML, and back end is all different.

I launched A for debugging, and it appeared in my browser as expected. I debugged the application for awhile, and then terminated debugging via the "stop debugging" icon on the toolbar within Visual Studio 2012.

I then launched B for debugging. Instead, I got A.

I tried clearing browser cache, though, this couldn't be the problem because the server side of the application was wrong too.

I tried Rebuilding the project, after running Clean. I still see A while trying to debug B.

I tried killing all processes related to the debugging session including all iisexpress.exe, MSBuild.exe, WebDev.WebServer40.EXE, Microsoft.VisualStudio.Web.Host.exe instances.

I tried closing Visual Studio 2012 completely, reopening it, and retrying debugging.

EDIT

After closing and reopening VS2012 for a third time, it started now allowing me to see B. Nothing else has changed.


Best I can come up with is there must be some type of project setting that needs to be changed to reflect that the project lives in a different space than it did before being copied, but I have yet to track down such a setting.

What am I missing?

I have just come across this issue today, having done exactly as you (copied a project, and then edited). And hence i would like to share my solution.

If you go to Project B 's Properties (found in solution Explorer), you will find a Web tab:

在此输入图像描述

In your Servers section, alter the Project Url to:

http://localhost: + (number +1) + /

and then hit Create Virtual Directory

You should then be able to re-run your project and since they're running off different Url's, you shouldn't see this clash again.

I was in the exact same situation. The problem was that both projects (Project_A & Project_B) we're setup to run on the same port in IIS Express.

IISExpress determines the port/application by looking at a configuration file located in <Documents>\\IISExpress\\config\\application.config.

Open that file and look for a section <sites>. You should find a list of your VS projects. Locate your projects (A and B) and make sure that both projects are not running on the same port

<site name="Project_A" id="17">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\Somefolder\ Project_A " />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:64212:localhost" />
</bindings>
</site>
<site name="Project_B" id="18">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\Somefolder\ Project_B " />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:64212:localhost" />
</bindings>
</site>

If that is the case, remove one entry (ie Project_B), and then go in Visual Studio to recreate the entry.

In VS, go in the Properties of Project_B. Click on Web tab and look for the “Servers” section.

Enter a new port (ie `http://localhost:64213`) and click on the button. 按钮。 This will add an entry in the “application.config” file, with the new association (ie Project_B / port 64213)

This should fix the problem. Hope this helps

This question is not marked as answered and as I had a similar problem I thought I would answer it.

you need to go to project > properties > web then check the use local web server box and overide application root if applicable, change the path names to the ones you are using save and it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM