13

The way we are used to debug a running "IISExpress" process in .Net Framework is by attaching a process by the name "iisexpress.exe" in Visual Studio. But attaching the iisexpress process is not working in .Net core. It shows the message - "The breakpoint will not currently be hit. No symbols have been loaded for this document."

tech-y
  • 1,451
  • 2
  • 12
  • 25
  • related: https://stackoverflow.com/questions/50806765/to-which-process-should-i-attach-visual-studio-debugger-to-debug-a-kestrel-appli – Ruben Bartelink Dec 05 '18 at 14:31

4 Answers4

29

To debug a running iisexpress instance in .Net core, you will have to attach "dotnet.exe" process in Visual Studio.
*Update - 1: If dotnet.exe does not work for you, check "{projectName}.exe" as well. *Update -2: Attaching "iisexpress.exe" works with .net 5

tech-y
  • 1,451
  • 2
  • 12
  • 25
15

In Visual Studio 2019 using "dotnet watch run" I could no longer attach to the "dotnet.exe" process, I would get the Symbols could not be loaded error, took me a while to figure out but instead I attached to [project name].exe which is in the list of running processes and I could successfully attach the debugger to a process with symbols loaded and debug.

Daniel Archer
  • 151
  • 1
  • 5
1

In my case, using Asp.Net Core 2.2 with InProcess Hosting Model, the accepted answer doesn't work. But, I should choose from the menu Debug > Attach to process, then select the "Show processes from all users" checkbox (below the list of process) and select "iisexpress.exe". It works properly and hit the break points.

S.Serpooshan
  • 6,368
  • 2
  • 29
  • 53
0

Visual studio does not loads all dlls (don't know why). Try this:

1) First attach with w3wp.exe (for InProcess Hosting) or dotnet.exe (for OutOfProcess Hosting)

2) Load Symbols manually:

Go to Debug > Windows > Modules (or try shortcut Ctrl + Alt + U)

Search and select dll (and dependent dll's) which you want to debug and right click > Load Symbols.

Sumit Joshi
  • 922
  • 1
  • 12
  • 21