简体   繁体   中英

Visual studio 2022 function app remote debugging failure

I have a function app deployed into Azure and I would like to remote debug it.

  • remote debugging is activated in the portal在此处输入图像描述

  • I have tested 32 and 64 bit platform

  • In Kudu, I can see "msvsmon.exe" running在此处输入图像描述

  • I have tried manually to "attach to the process" with the port requested in the microsoft documentation regarding Visual studio versions

  • I have tried from a VM in Azure

  • I have deactivated firewall in the VM

  • I have added an outbound rule will all permissions in the vm network settings

  • I have tried with VS 2019 version and the "Cloud explorer view"

  • I have tried with VS 2022 (Up to date --> Version 17.3.2) with "connected services"

在此处输入图像描述

And I always get this error:

System.Runtime.InteropServices.COMException (0x89710023): Unable to connect to the Microsoft Visual Studio Remote Debugger named 'HOSTNAME.azurewebsites.net:4024'. The input data was not in the expected format or did not have the expected value.

at Microsoft.WebTools.Azure.VS.Operations.IDebuggerInternal120.ConnectToServer(String szServerName, VsDebugRemoteConnectOptions[] pConnectOptions, CONNECT_REASON ConnectReason, Int32 fIncrementUsageCount, IDebugCoreServer3& ppServer) at Microsoft.WebTools.Azure.VS.Operations.RemoteDiagnosticsSessionBase`1.ConnectToServer(String hostNameWithPort, String user, String password)

Any idea how to fix?

Please check the following steps to remote debug in Visual Studio 2022:

  1. Switch the remote debugging to on in Azure Portal Function App Configuration > General Settings
  2. In Visual Studio 2022 Azure Functions Project, publish to Function App in the debug mode.

在此处输入图像描述

  1. Click on Open Site to check the function app is up and running. And then click Attach debugger on Hosting options ( ... ) in the VS Publish window.

It will take some time to attach the w3wp process automatically and activating the breakpoint we placed in the Function Code.

  1. After activating the breakpoint, hit the Azure portal function app trigger URL in the browser, then within 2 to 3 minutes, VS will start the remote debugging as you can see in my below Gif.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM