Atta" /> Atta" /> Atta"/>

ASP .NET Connect to Azure Process and debug

105 Views Asked by At

I am trying to debug a deployed service on Azure Cloud by attaching to the process "w3wp.exe".

  1. Set Remote Debugging - On in Azure Cloud.
  2. Debug -> Attach Process -> Connection type: Microsoft Azure App Services -> Login then select the Web App from Cloud -> Select process w3wp
  3. Tools -> Options -> Debugging
  • 'Enable Just My Code' unchecked
    Symbols load, takes 1-2 minutes then an error appears:
System.IO.IOException
  HResult=0x80131620
  Message=Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
  Source=System.Net.Sockets
  StackTrace:
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)

Inner Exception 1:
SocketException: The I/O operation has been aborted because of either a thread exit or an application request.
  • 'Enable Just My Code' checked
    Symbols are not loaded. I put a breakpoint on a simple Get method and VS warns me: The breakpoint will not be hit. Symbols have not been loaded for the current document.

Questions:

  1. Do you know how can I debug my remote Azure Web app? What am I doing wrong?
  2. My seniors told me it is no longer possible due to security concerns from Microsoft developers. The remote debugging is now disabled. I don't know if its true.
    Do you know any update on this? Can I still from local Visual Studio 2022 attach to an Azure Cloud Web App and debug on my computer the remote application?
1

There are 1 best solutions below

2
Rajesh  Mopati On

To debug a deployed service on Azure Cloud by attaching to the process "w3wp.exe",

Steps to debug

  • In Visual Studio, go to Debug -> Attach Process.

enter image description here

  • In the Attach to Process dialog, select Connection type as Microsoft Azure App Services.
  • And click on find and it will prompt to login with your Azure account and select the Web App from Cloud.

enter image description here

enter image description here

  • Select the process w3wp.
  • In Visual Studio, go to Tools -> Options -> Debugging and make sure 'Enable Just My Code' is unchecked.
  • And wait for symbols to load.
  • If you get an error then Enable Just My Code and see if the symbols load.

enter image description here

Debugging code.

enter image description here

  • Run the application with a debug point.
  • Then the debugger hits the breakpoint and allows you to step through the code.

To follow another approach, refer to this SO link.