Unable to “Attach to Process” when trying to debug an Azure App Service web app (with private endpoints) from Visual Studio

Normally, you can attach the Visual Studio debugger directly to an Azure App Service to debug your web app (similar to what you would do if wanted to debug a web app running in IIS).

Remote Debug ASP.NET Core on Azure App Service – Visual Studio (Windows) | Microsoft Learn

However, if you have enabled private endpoints on your App Service (to disable access to the multi-tenant version of App Service from the Internet), you will be unable to attach the debugger.

You will get error messages like:

Unable to connect to the Microsoft Visual Studio Remote Debugger.
Operation not supported.
Unknown error 0x80004005
The Visual Studio 2022 Remote Debugger (MSVSMON.EXE) does not appear to be running on the remote computer. This may be because a firewall is preventing communication to the remote computer.

I expected this behavior if I tried to connect to my App Service from my local computer since it is not on the same network as the App Service and private endpoint removes the public Internet access.

However, I tried to connect from a VM running in the same virtual network and still was blocked.

This is explicitly called out in the Limitations section of the documentation but is surprising.

The recommendation is to create a deployment slot and attach the debugger to the slot (which wouldn’t have a private endpoint enabled on it).

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *