Visual Studio 2015: debugging MVC controller

13,590

To debug a MVC solution:

Attach to Running Processes with the Visual Studio Debugger:

  1. Build your solution and open your site on any web browser.
  2. Place your breakpoint(s) in your server side code.
  3. Under Debug > Choose Attach to process (Or ctrl+alt+p)
  4. In the process list, choose the w3wp.exe or iisexpress.exe process (depending on your project type), and click attach.
  5. Wait for visual Studio to load all relevant symbols referenced by your project (this might take a while).
  6. Once all symbols are loaded, the debug point should turn Red.

This means that you can now use your web site and reach an active breakpoint.

Share:
13,590
jeanie77
Author by

jeanie77

Updated on June 27, 2022

Comments

  • jeanie77
    jeanie77 almost 2 years

    I'm developing a Word Add-in and I changed the default web project to a custom ASP.NET MVC project. I tried adding a breakpoint to a certain method on controller but it's not reached.

    Is there something I could do to debug the server side C# code, as if it were a normal web project?

  • Koby Douek
    Koby Douek about 7 years
    @jeanie77 Happy to help! Happy coding, peace and love.