21

I appears that the Cloud Explorer has now been retired in Visual Studio 2022. This was something that I used many time a day and will sorely be missed. I used to be able in the Cloud Explorer select the app service, right click, and attach the debugger to the app. In Visual Studio 2022 I can find no way of attaching the debugger the the remote Azure app service. Also browsing the web I can't find any documentation on how to do this. Can someone supply directions on how to do this, or point me to the documentation on how to debug an Azure app on the remote server.

Terry151151
  • 631
  • 1
  • 8
  • 15

3 Answers3

31

Currently there's an option to debug Azure App Service.
Instead of using the cloud explorer you may create a publish profile and attach a debugger from there:

enter image description here

enter image description here

enter image description here

All in VS 2022.

Mr Patience
  • 1,564
  • 16
  • 30
  • I used it on Azure Function but it never got to the code when I ran the post from Postman. Is there another way I can start the code for Azure Functions? – Ofer Gal Nov 18 '21 at 18:47
  • @OferGal Can you clarify what you mean by 'start the code'? – Mr Patience Nov 20 '21 at 10:38
  • I mean something to test or debug the code running in Azure and find the error after sending the post from Postman – Ofer Gal Nov 20 '21 at 12:59
  • 3
    Just now I found that in the "Publish" pane I can use "View streaming logs" and see the error as they happen – Ofer Gal Nov 20 '21 at 13:07
  • When I go to publish in debug mode, it throws an error: "ERROR_USER_NOT_AUTHORIZED_FOR_DEPLOYMENTPROVIDER" Works fine in Release mode. – Scuba Steve Sep 21 '22 at 06:01
  • A gotcha to consider: My app service was configured to allow debug for vs 2018 (its an old service... created circa 2013 and I have not had a reason to debug it for many years... until now... anyway. hope that helps someone.) – Hunter-Orionnoir Jul 11 '23 at 20:19
13

I’ve had the same problem, trying to do remote debug an App Service with VS2022. I just realised that the top dropdown box “Connection Type” on Debug | Attach to Process... dialog gives you an option “Microsoft Azure App Services” (I'm using ver 17.2.4). Clicking the Find button lets you select target App Service. You can then select the target process. (Attaching from the Publish dialog doesn’t let you select the process - you may have a number of apps on virtual directories).

One thing I noticed and confusing; the listening port is not 4026 but 4024 even though you specify VS2022 on the Azure Portal in my case. Telnet or Psping to 4026 – no response. If you do the above way, this doesn’t matter but if you select Connection Type: “Default” and specify host:port, then the port should be 4024. You can remotely debug Azure Function in this way.

yosh
  • 231
  • 3
  • 7
5

Today with Visual Studio 2022 you can use the Connected Services node under a given project:

enter image description here

Once you connect to an app service, you'll have access to attach the debugger:

enter image description here

Microsoft Learn Module

Remotely debug ASP.NET Core apps hosted on Azure App Service using Visual Studio

More info here:

Manage the resources associated with your Azure accounts in Visual Studio Cloud Explorer

Overview: Connected Service

Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
  • Worth noting that this functionality is totally broken with ASP.NET classic in VS2022. It does not work at all. You can connect the app service under connected services, but it does nothing, zero actual functionality. – Scuba Steve Sep 20 '22 at 21:31
  • Connected Service->Azure App Service doesn't exist on my end – Francis Ducharme Nov 30 '22 at 16:05