garfbradaz
garfbradaz

Reputation: 3500

Debugging Console App and Web API App from Visual Studio 2010

Problem

I have a Visual Studio 2010 solution that contains various class library projects, 1 ASP.NET Web API project and 2 Console Application projects.

Now the console applications use the WebClient class to communicate with the Web API project I have within the Solution. When I run one of the console applications, the Web API is automatically run within the VS ASP.NET WebDev Server (within Localhost). This is fine. When I set breakpoints within the Web API solution (say one of the controllers), they are not hit during debugging. Only the console breakpoints are hit. Now if I run the Web API solution directly, and use something like REST Easy FF addon to build the request, the breakpoints are hit.

Is there a option in Visual Studio 2010 to break across two different applications at once when debugging?

Technology I'm using

  1. Visual Studio 2010 SP1
  2. Console applications are .NET 4.0 projects
  3. Web API project is the 1st release

Upvotes: 3

Views: 2828

Answers (1)

Dvir
Dvir

Reputation: 3139

I can think of several methods to cope with your question:

  1. explicitly load the symbols from Solution A: go to Tools->Options->Debugging->Symbols you can point it at the .pdb file from Solution A. Then you can see if the symbols are loaded from your binaries by going to Debug->Windows->Modules while debugging.
  2. Disable the Debugging feature named "Just My Code". This is a feature aimed at minimizing the debugging experience to just the code in your solution. In order to disable it:

Tools -> Options -> Debugging

Unchecked "Enable Just My Code"

  1. Last option is using the solution I've found in a different question someone posted:

Here is what I did.

Say a project from solution A refers a project from Solution B and I want to debug into solution B project from Solution A project.

Open Solution B in Visual Studio. Set the project properties to "Use Local IIS Wb Server", set the project Url and create Virtual Directory.

Open Solution A in another Visual Studio Instance. Set the project properties to "Use Local IIS Wb Server" and Check "Use IIS Express", set the project Url and create Virtual Directory.

Press F5 and start debugging Solution B instance of Visual Studio. Then Press F5 and start debugging Solution A instance of Visual Studio. Now both the instances of Visual Studio will be in debug mode. Start from Solution A now and you should be able to debug into Solution B just like if both projects were in the same solution.

The key here is to "Use IIS express" for one and "Local IIS Web server" for the other project. This will let you have two debuggers running at once.

Source: https://stackoverflow.com/a/25630033/3125120

I hope it helps.

Upvotes: 2

Related Questions