Manually Attach a Debugger to Azure Web Apps


For various reasons you may have difficulty attaching your debugger to an Azure Web App.  This quick blog will show you a method that may work for you if you get into this situation.  I will NOT attempt to diagnose your issue in this blog so please don’t post a question asking why the normal methods don’t work for you (like right clicking your resource in Server Explorer of Visual Studio).

Ensure you have enabled debugging in the Azure Portal for your App and it is set to the correct version of Visual Studio (don’t forget to save):

snip_20170606155727

Note: 

Please also make sure when deploying the app, Debug configuration is selected.  For example: in Visual Studio Web Deploy…snip_20170322133336

 

Step 1. From the main menu, click on the Debug menu item and select Attach to Process …

 

snip_20160209113425

Determine the remote debugging port from this article:  Visual Studio remote debugger port assignments.  For example, Visual Studio 2015 uses port 4020.

Type in the URL of your Azure Web App and add the port determined above then hit enter and a credential dialog will appear:

snip_20160209114253

For the User name and Password you can download the Publish Profile and extract it from there:

snip_20160209114840

Look for “userName” and “userPWD” in that file.  Note when you enter the user name you will need to also include the domain.  For example: if the username is ‘$constowebapp’ when you enter it in the credential dialog it should be entered like this ‘$contosowebapp\$contosowebapp’.

Now that you are authenticated choose the w3wp.exe process (Standard .NET app):

snip_20160209115800

For a .NET core app you will want to ensure you choose Managed(v4.6, v4.5, v4.0) code and then the name of the Core app (not w3wp.exe):

clip_image002[6]

 

I know this was a quick and dirty blog but let me know if this helped you out.  Again… My intent is not to troubleshoot your connection issues (firewall could be in the way, invalid or outdated publish profile could be associated with your app… The list goes on and on) but to get you unblocked so you can debug!


Comments (1)

  1. Zenon Iwanicki says:

    Very good tip. Debugging is working. Thx for help. Zenon

Skip to main content