Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot debug IIS deployed ASP.NET Core MVC on full .net framework

I am stuck for over an hour already trying to debug my ASP.NET Core MVC application. It is using Full .Net Framework 4.6.1

Debugging using IIS Express works like a charm, but when deploying the project to IIS, I am attaching Visual Studio Debugger to "w3wp" process, it attaches but I keep seeing my breakpoints not enabled due to lack of symbols.

I have tried quite a few combinations of attaching the debugger, updated visual studio (I am using VS 2017), but all without any luck.

I have tried both stackoverflow and MS docs, but nothing for debugging ASP.NET core targeting full .NEt framework.

The worst thing is that I had a similar issue a few weeks ago, but did not record how it was resolved.

Any idea on what I am doing wrong?

Update: Issue happens on Windows Server 2012 R2, but on Windows 10 debugging works as expected.

like image 770
Andre Platov Avatar asked Mar 08 '23 07:03

Andre Platov


1 Answers

Okay, I think I understand what happened.

First of all, root causes:

  1. I was not debugging the correct process initially. It was not usual w3wp, instead it was the name of my project (like "MyAspNetCoreApp").
  2. While monkeying with Debug settings, I disabled "Enable Edit and Continue" setting and enabled "Use Managed Compatibility Mode". It apparently made things only worse.

Whew...

Now, troubleshooting that helped resolve the issue:

  • I ended up trying to debug my app on Windows Server remotely. Using this MS article helped me setup remote debugging for my Visual Studio (2017).
  • I then successfully attached to the process on Windows Server (My VS was on Windows 10)
  • That hinted that the issue has most likely something to do with VS, since remote debugging worked.
  • At that point I went on to check the debugging settings in Both Visual Studios, one on Windows Server and another on on Windows 10.
  • This is when I noticed the difference, changed it on Windows Server's VS and it worked!!!

What was very confusing, is that Microsoft's documentation was always using w3wp and now dotnet processes as ones to attach to.

Do not get me wrong, the ability to attach to the process by the assembly name is awesome, I only wish it was clearly reflected in the documentation. Hopefully the folks will catch up soon :)

like image 165
Andre Platov Avatar answered Apr 08 '23 20:04

Andre Platov