14

I've got an ASP.NET website that I deployed to Azure. I'm using VS2013, .NET 4.5.1 and Azure SDK 2.2. I turned on remote debugging for VS2013 in the management portal. I can successfully right click the website under the "Azure" node in servers, and select "Attach debugger." It says that it is downloading debugging settings, and then the web browser comes up. But breakpoints are never hit despite them being in code that I know is executed. One clue: the breakpoint has an open circle and states: "The breakpoint will not currently be hit. No symbols have been loaded for this document." But the breakpoint works fine when testing locally. Does anyone have any thoughts on how to address this?

Thanks...

-Ben

Update: I dropped from .NET 4.5.1 to 4.5; problem persists.

BenjiFB
  • 4,545
  • 10
  • 46
  • 53
  • 1
    See this answer : http://stackoverflow.com/a/19869600/940160 – Gabriel Boya Mar 19 '14 at 17:33
  • 1
    Thank you! That thread had the solution. It should be noted that I was experiencing this problem even though I am not using GIT deploy, so this thread may still be valuable to others. – BenjiFB Mar 19 '14 at 19:52
  • This problem is not fixed for me. The only pertinent solution from that other thread was to [Turn off Just My Code debugging] but I had already done that. – Nicholas Petersen Aug 06 '14 at 17:24

7 Answers7

8

I also struggled with this (VS2015 Enterprise) but found a solution that works pretty consistently.

  • Make sure you aren't attached to the web app
  • Open up the Azure portal for the web app
  • Stop the web app
  • Restart the web app
  • Give it a second to warm up, then go back to VS and re-attach

This works for me almost every time. Note that stopping and starting the web app from w/in Visual Studio does not work consistently.

Lars
  • 9,976
  • 4
  • 34
  • 40
6

Make sure you publish a debug build to a specific deployment slot. I had this same problem and when I attached the remote debugger to my staging slot that had a debug build deployed there, it worked. Trying to debug a release build doesn't work because the requisite debug symbols are not present. Like @Lars explains above, I had to restart the web app on Azure and then try the debug again against the debug build.

CrusherJoe
  • 141
  • 4
  • 5
4

I wrote a short article what helped me with debugging. Have a look here: Debugging in Azure Cloud

In a nutshell: Find the correct processes to attach to for worker role and web role. WebRole: WaIISHost.exe, w3wp.exe + conhost(s) WorkerRole: WaWorkerHost.exe + conhost(s)

4

After struggling with this for hours, I found a consistent solution. I think the root cause is simply a confusing UI. Try this:

  1. Make sure your Web Job is running
  2. VS 2017 -> View -> Cloud Explorer
  3. Click on the WebJob name in Cloud Explorer then simply wait. After 15s or so, "Attach Debugger" will magically appear in the actions area below. It seems that when you click on the WebJob name, VS2017 has to query the WebJob remotely in Azure to determine if it's both running and if it's possible to perform remote debugging, which takes time. If the answer to both is "yes", then "Attach Debugger" will appear in the UI.

enter image description here

BlueSky
  • 1,449
  • 1
  • 16
  • 22
  • After updating VS 2017 (+ Cloud Explorer) and trying various other solutions like restarting the web app, THIS was the way I got to debug my Azure Webjob. Big thanks! – Abbas May 24 '22 at 15:12
0

I ran into this issue a few times.

I got it fixed by making sure the platform/configuration of my publish profile matched my local build platform/configuration.

I was publishing Debug | Any CPU, but my local build was using Debug | Mixed Platforms.

Once I changed my publish configuration to Debug | Mixed Platforms and republished, I was able to attach the remote debugger and the symbols were loaded.

Verify the symbols are loaded for the assembly you are attempting to set breakpoints in by looking in the Visual Studio 'Modules' window for the namespace/assembly name. (This is after attaching the debugger to the remote process and your VS is in Debug mode.)

After I did this, breakpoints began working for the remote process from within my local VS instance.

boylec1986
  • 520
  • 5
  • 12
0

For VS 2022:

Couple of things to note. First need to go to your App Service and enable debug: enter image description here

Then need to uncheck "Enable Just My Code" from VS: Debug->Options enter image description here

Finally attach to websiteurl.azurewebsites.net with w3wp.exe

Juliyanage Silva
  • 2,529
  • 1
  • 21
  • 33
-1

I was having this problem with a .Net Core Azure Function project. The following github issue speaks to it, but solution didn't solve my problem:

https://github.com/Azure/Azure-Functions/issues/872

I finally stumbled across the answer here:

http://dontcodetired.com/blog/post/Remote-Debugging-Azure-Functions-V2-The-breakpoint-will-not-currently-be-hit-No-symbols-have-been-loaded-for-this-document

It boils down to manually attaching to the process in Azure, rather than relying on the Cloud Explorer right-click functionality.

Marty
  • 1,182
  • 2
  • 13
  • 22