15

I am trying to remote debug an Asp.Net Core Web Application (with Web API) project deployed as an Azure App Service with Visual Studio 2017 Professional.

Followed the instructions as documented here. Essentially, using the Server Explorer-->App Service-->Attach Debugger

Also, enabled the necessary firewall ports as mentioned. The ones I opened are TCP (4022, 4023) and UDP (3702). Also, ensure remote debugger application is in allowed list of apps in Windows Firewall. Documentation for the firewall steps.

Despite all the settings, I am getting following error

System.Runtime.InteropServices.COMException (0x89710023): Unable to connect to the Microsoft Visual Studio Remote Debugger named 'essamplepoc2.azurewebsites.net'.  The Visual Studio 2017 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. Please see Help for assistance on configuring remote debugging.
   at Microsoft.VisualStudio.Debugger.Interop.Internal.IDebuggerInternal120.ConnectToServer(String szServerName, VsDebugRemoteConnectOptions[] pConnectOptions, CONNECT_REASON ConnectReason, Int32 fIncrementUsageCount, IDebugCoreServer3& ppServer)
   at Microsoft.VisualStudio.Web.Azure.MicrosoftWeb.Operations.RemoteDiagnosticsSessionBase.ConnectToServer(String site, String user, String password)

Any suggestion would be helpful.

H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
Nitin Rastogi
  • 1,446
  • 16
  • 30

4 Answers4

9

The issue is resolved. We had to open outbound ports 4024 for VS 2019, 4022 for VS 2017 and 4020 for VS 2015 on corporate firewall.

For more info check these out:

Alireza Sattari
  • 181
  • 2
  • 12
Nitin Rastogi
  • 1,446
  • 16
  • 30
7

I also had this problem. I solved it by changing the Platform from 32-bit to 64-bit in Application Settings as I am trying to debug from 64-bit machine.

Screenshot

Marius Stănescu
  • 3,603
  • 2
  • 35
  • 49
1

It seems remote debugging is not turned on for your App Service.

Open your App Service in the Azure portal and go to Application Settings. Then turn Remote Debugging to On and select Visual Studio Version to 2017.

It should look like this: enter image description here Screenshot source

I hope this helps.

  • Have you tried attaching the debugger manually using Debug > Attach to Process. – Erwin Damsma Jul 09 '17 at 12:04
  • Also check out this article: https://blogs.msdn.microsoft.com/jpsanders/2016/02/09/manually-attach-a-debugger-to-azure-web-apps/ – Erwin Damsma Jul 09 '17 at 12:12
  • 2
    Tried the attach to process option, but it fails with following when I try to attach a process by specifying the url to the site - Unable to connect to Microsoft Visual Studio Remote Debugger named 'mysite,azurewebsites.net:4022'. The Visual Studio 2017 Remote Debugger (MSVSMON>EXE) does not appear to be running on the remote computer. This may be because a friewall is preventing communication to the remote computer. – Nitin Rastogi Jul 10 '17 at 14:02
  • Does same issue appear if you remote debug other azure web app? – Fei Han Jul 11 '17 at 10:18
  • Im having the same issue. Tried a bunch of different things. Any luck on this? – NormTheThird Aug 02 '17 at 03:24
  • @NormTheThird - Yes, the issues is resolved. You could see the answer below. – Nitin Rastogi Aug 02 '17 at 19:11
0

First, what did NOT work. Opening the port in my Firewall did not work for me. Restarting my local machine did not work, neither did restarting the app in Azure, nor updating VS2019 with the installer. I kept getting:

System.Runtime.InteropServices.COMException (0x89710023): Unable to connect to the Microsoft Visual Studio Remote Debugger named 'empirepipedriveapi-newversion.azurewebsites.net'. The connection with the remote endpoint was terminated.

Finally, what DID work, I deleted the deployment slot and then added it again, I deleted the publish profile in Visual Studio 2019 and recreated it again, a published the app (without even recompiling it) and then WAS able to connect (I did refresh the available slots in the Cloud Explorer first just to be overly careful). I believe, and this is the 2nd time in about a year, that, on rare occasion, the deployment slot can become corrupted. I noticed this time when I published the app, it took longer and it seemed much more activity took place, leading me to believe that there was code in the old slot that was is not refreshed on each and every publish and it must have become corrupted.

GTuccio
  • 11
  • 4