How do you remotely debug an Azure cloud service extended from Visual Studio?

Glenn Rockland 6 Reputation points
2024-05-09T22:04:44.73+00:00

Before migrating from a classic cloud service to extended I was able to remotely debug the cloud service from Visual Studio 2019. Now the Server Explorer does not display the migrated service so can not attach debugger from there. Other methods of attaching to debugger described in the documentation do not work. Please elaborate.

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
665 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Glenn Rockland 6 Reputation points
    2024-06-04T19:29:49.04+00:00

    I finally found out how to do this. You have to go to Azure portal and to the cloud service WorkerRole in Roles and Instances and click Connect. This sets up a remote desktop where you have to install the Remote Tools and run msvcmon.exe. Then you have to go to the machine where you enable RemoteDesktop, enter login and pwd, and Publish (extended). Then go to Debug=> Attach To Process and enter the Connection Target with ip of service and port 4024 (or whatever you selected). You then should be able to read Debug messages and set breakpoints on the cloud service.

    1 person found this answer helpful.

  2. Sedat SALMAN 13,265 Reputation points
    2024-05-10T03:19:37.6333333+00:00

    there is an official Microsoft documentation to follow

    https://video2.skills-academy.com/en-us/visualstudio/azure/vs-azure-tools-debug-cloud-services-virtual-machines?view=vs-2019

    the most critical different between vs 2022 and vs 2019

    you need to be careful about remote debugger port assignment

    https://video2.skills-academy.com/en-us/visualstudio/debugger/remote-debugger-port-assignments?view=vs-2019


  3. kobulloc-MSFT 25,561 Reputation points Microsoft Employee
    2024-06-03T19:13:52.2033333+00:00

    Hello, @Glenn Rockland ! We've received your feedback and want to make sure that your question has been answered.

    How do you remotely debug Azure Cloud Services (extended support) from Visual Studio?

    We confirmed remote debugging with a worker role using the latest release of Visual Studio 2022 following the documentation. During testing, we put in <ipaddress>:4026  in the Debug->Attach To Process dialog and successfully connected after a short wait.

    There are a couple things to note:

    • Use port 4026 for Visual Studio 2022
    • Build in debug
    • Endpoint defined for 4026 in the .csdef file.    
    • Run MSVSMon.exe as Administrator

    If you are still running into issues after checking the notes, there are likely network restrictions that require troubleshooting. We were unable to ping the IP address as well, so the server is likely not setup to respond to ping by default.

    User's imageUser's image


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image


  4. kobulloc-MSFT 25,561 Reputation points Microsoft Employee
    2024-06-04T21:09:56.1133333+00:00

    Hello, @Glenn Rockland !

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue:

    Before migrating from a classic cloud service to extended I was able to remotely debug the cloud service from Visual Studio 2019. Now the Server Explorer does not display the migrated service so can not attach debugger from there. Other methods of attaching to debugger described in the documentation do not work.

    Solution (by Glenn Rockland):

    I finally found out how to do this. You have to go to Azure portal and to the cloud service WorkerRole in Roles and Instances and click Connect. This sets up a remote desktop where you have to install the Remote Tools and run msvcmon.exe. Then you have to go to the machine where you enable RemoteDesktop, enter login and pwd, and Publish (extended). Then go to Debug=> Attach To Process and enter the Connection Target with ip of service and port 4024 (or whatever you selected). You then should be able to read Debug messages and set breakpoints on the cloud service.

    List format:

    1. Go to the Azure portal
    2. Go to Cloud Service WorkerRole in Roles and Instances
    3. Click Connect. This sets up a remote desktop where you have to install the Remote Tools and run msvcmon.exe.
    4. Go to the machine where you enable RemoteDesktop.
    5. Enter login and pwd, and Publish (extended)
    6. Go to Debug=> Attach To Process and enter the Connection Target with ip of service and port 4024 (or whatever you selected)

    You then should be able to read Debug messages and set breakpoints on the cloud service.


    If you have any other questions or are still running into more issues, please let me know. Thank you again for your time and patience throughout this issue.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution. Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments