Azure Service Debugging hangs on attach to process how can I trouble shoot this? - azure

I'm trying to debug a deployed Azure Worker Role. I have the service published from visual studio and confirmed it is running on my Azure dashboard. In visual studio I right click the Instance of the role (only 1 is there) and select debug. After 5+ minutes I get the process dialog box and I select the WaWorkerHost.exe process. After that nothing is happening - I have a visual studio dialog that says "A remote operation is taking longer than expected". It has been 25 minutes so far.
1) I need to be able to debug my service and I'd like to do it vs the Azure published version. How can I debug this hanging operation?
2) 30+ minutes is not reasonable to wait for a debugger to attach. Is there any way to improve the process?

To be able to debug your Azure cloud service, you first need to make sure it is built with the Debug configuration and that the remote debugger feature is enabled, then you'll be able to attach to the role from Visual Studio as if you were running it locally.
You can follow these steps to enable the debugger and attach to the service: https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-debug-cloud-services-virtual-machines/

Related

Remote debug Azure web job with .NET 6 in Visual Studio 2022

I followed this tutorial to create a simple web job in Azure: https://learn.microsoft.com/en-us/azure/app-service/webjobs-sdk-get-started. The web job itself does its job, consumes the message in the queue and I see them appear in Application Insights.
However, I want to debug the function on my local machine by using the tools available in Visual Studio 2022.
I have published with following profile settings:
Next I've attached the debugger under het Hosting menu:
First thing I noticed is a message about no symbols being loaded when putting a breakpoint in the function:
When I add a message to my queue, it gets consumed by the web job but the breakpoint is never hit. I've been reading a lot of similar questions regarding a this issue but I'm not progressing any further.
In Azure Portal, I've enabled Remote debugging under Configuration > general settings
In Visual Studio 2022, I checked if the correct process is attached
Here I'm a bit confused thou, the connection target is connecting through port 4024, which is according to this document, the port for Visual Studio 2019. However, a connection target with port 4026 is not found.
What am I missing here? Am I forgetting another setting somewhere?
If have tried changing the stack setting .NET version from APS.NET V4.8 to NET 6 (LTS) but that didn't help.
Should the platform architecture match the architecture of my machine in order to get it to work? Or is this not linked in any way with the debugger?
Is there anything else that I should check or try? Because my hair is turning grey here :)
Apologies for the delay here!
It should be 4024 for both 32 and 64 bit.
See this Azure doc: Remote Debugger Ports on Microsoft Azure App Service
Typically, the error “The breakpoint will not currently be hit. No symbols have been loaded for this document.” -- This error message indicates we can start debug process and attach, but cannot set a breakpoint on any or some lines of code in the project.
Most, likely cause: Application is built without debug symbols or debug symbols are not available
Kindly try these steps:
Verify Debug Symbols are being used and published and in sync
Workaround the issue by disabling “Enable Just My Code” from the
Tools >> Options >> Debugging >> general menu in Visual Studio
Other things to narrow-down the issue:
Debug symbols must be available locally or deployed to the Azure App Service, and must match the local code you are trying to debug.
It is recommended to use Cloud Explorer over Server Explorer to
connect and debug which requires the Azure SDK.
You could optionally Manually Attach a Debugger to Azure Web Apps to troubleshoot this further or recommend this as a workaround.
(old blog, try similar steps)
Kindly verify the port (Visual Studio remote debugger port assignments ) required is open in the corporate firewall and on your local machine.
As a test, you may use tool like Wireshark/netmon, to see if the port successfully connects to the port (4024) needed by the process.

Azure Remote Debugging - Network connection has been lost

I have an ASP.NET MVC 5 web application/API that I am running on Azure.
I am trying to remotely debug my application by attaching a debugger in Visual Studio 2017:
However, almost immediately this error pops up and debugging is aborted:
Sometimes it hits one of my breakpoints but then immediately stops. I have tried restarting my app a number of times but this didn't seem to help.
Any ideas?

visual studio 2017 remote debugging azure api app: "The breakpoint will not currently be hit. No symbols have been loaded for this document."

I'm trying to remote debug an asp.net core 1.1 api app (targeting .net framework 4.5.2) that's running on Azure.
I attach the debugger via Server Explorer. The debugger attaches to the correct process. But any breakpoint I set has the message "The breakpoint will not currently be hit. No symbols have been loaded for this document."
All answers I've seen to such a problem assume that the modules window shows all modules loaded by my project, but in my case the modules window is empty!
I'm on VS2017 15.4.
If I remember correctly, I was previously able to remote debug the same project with version 15.2. The problem started occurring when I updated to 15.3 but I didn't pursue it at the time.
I submitted the problem on the MS forums: Can't remote debug Azure API app
and now I have received an official reply that it is indeed a bug in VS, and a fix will be available in the pending release (15.6).
They also suggested a workaround, which I tried and indeed worked: Manually Attach a Debugger to Azure Web Apps
Which involves:
Going to the web app Application settings in the Azure portal, and making sure that Remote debugging is enabled,
In the VS menu: Debug > Attach to Process..., entering the web app url with the debugging port, e.g.:
myapp.azurewebsites.net:4022
Then in the credentials that appears, entering the username & password that are available in the app's Publish Profile, which can be downloaded from the portal. If the username is $myapp, it should be entered like this:
$myappp\$myapp
Then choosing Managed(v4.6, v4.5, v4.0) code and then the name of the Core app.
Actually, I had found and unsuccessfully tried similar approaches before. The key for me was step 3. The others had suggested entering the username as .\$myapp, or myapp\$myapp. So make sure to enter it as written above.
BTW, seeing that the above blog post is from almost 2 years ago (Feb 2016), whereas the problem I'm experiencing was introduced only a few months ago, it seems to be a cure-all, and it is therefore worthwhile, for anyone who has to deal with remote debugging Azure apps, to save this information for future reference.
UPDATE:
After updating VS 2017 to version 15.5.2 the problem seems to have been fixed.
I have had the same issue with Visual Studio 2019. The fix for me was just to go in the VS menu: Debug > Attach to Process, and try to connect as describe by #Dan Z. The connection was not established, saying No connections found, but attaching a debugger from Cloud Explorer again, right after an attempt in "Debug > Attach to Process" is always successful. That is most probably a bug in VS

How can you debug Classic ASP on an Azure Web App?

I'm using Visual Studio 2015, and a Classic ASP app running on an Azure Web App.
In VS, on the Server Explorer, I can right-click on the Azure Web App and select Attach Debugger.
PROBLEM: it attaches to debug "Managed Code" which isn't helpful since VBScript isn't managed code. I can set breakpoints in the default.asp file (for example) which show up as filled red dots suggesting it's loaded symbols, which is encouraging, but the breakpoint is never hit.
QUESTION: how can I get it to connect and debug "Script"?
FYI I can do this just fine against iisexpress.exe running on my local dev machine. I see "Script, Managed Code" as available options, and can select "Script". The exact same breakpoint gets hit as I'd expect.
Has anyone gotten this working successfully against an Azure Web App? If so, how did you do it?
Thanks!

Debugging WCF services in Visual Studio 2012

How can I tell which of my services is the one that I am trying to debug?
Using the Visual Studio 2010 debugger I would just look for the w3wp (or whatever the heck it was) that was running under the app pool username that my service was running under.
But now in my attach to processs window I have 3 msvmnon.exe processes and I don't see any wcf services running? What am I missing?
What I wasn't doing was checking the show processes from all users.
Set your WCF services project as startup in VS 2010. Then run the project, you will get a window with all services defined on the left side. Click on the service you wish to execute and pass parameters if any

Resources