Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2022 Debug On Remote Azure Server

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.

like image 917
Terry151151 Avatar asked Oct 13 '21 04:10

Terry151151


People also ask

How do I remotely Debug Azure web app from Azure?

Enable the remote debugging on Azure To remotely debugging an application, you have to turn on the remote debugging feature and define the version of Visual Studio on your web app configuration in Azure portal. In the Azure portal, open your app's resource page. In the left navigation, choose the Configuration option.

How do I Debug Azure web app in Visual Studio?

In Solution Explorer, right-click the project, and click Publish. In the Profile drop-down list, select the same profile that you used in Create an ASP.NET app in Azure App Service. Then, click Settings. In the Publish dialog, click the Settings tab, and then change Configuration to Debug, and then click Save.

How do I Debug a remote process in Visual Studio?

Select Configure remote debugging to configure the firewall and start the remote debugger. When configuration is complete, the Remote Debugger window appears. The remote debugger is now waiting for a connection. Use the server name and port number shown to set the remote connection configuration in Visual Studio.

How to enable remote debugging for Microsoft Visual Studio 2022?

On the Configuration page, select the General option settings from the top menu On the Remote Visual Studio version property, from the dropbox select the Visual Studio version you are using, in my case 2022. In resume, for us to be able to remote debug you need to guarantee that: The DLL version published on Azure should match the local version

How do I debug on a remote device or server?

On the remote device or server that you want to debug on, rather than the Visual Studio machine, download and install the correct version of the remote tools from the links in the following table. Download the most recent remote tools for your version of Visual Studio.

How to enable remote debugging in azure appservice?

Now time to enable remote debugging. In your Visual Studio, go to View -> Server Explorer. In the server explorer, configure your Azure account, which will list all your AppServices in the account. Right-click on the AppService that you published in Step 8 and choose “Attach Debugger” as shown below.

How do I debug a Visual Studio application on a different computer?

You can debug a Visual Studio application that has been deployed on a different computer. To do so, you use the Visual Studio remote debugger. For in-depth instructions on remote debugging, see these topics.


2 Answers

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.

like image 136
Mr Patience Avatar answered Nov 15 '22 06:11

Mr Patience


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.

like image 41
yosh Avatar answered Nov 15 '22 07:11

yosh