Trying to Attach debugger in VS 2022 to an HTML page

Muhammad Fasih Akbar 0 Reputation points
2024-03-06T13:26:25.3066667+00:00

Hi,

I am running an HTML page in Microsoft Edge from a VS 2022 (say it instance 1).

In another VS 2022 (say it instance 2), I have attached a debugger to the MS Edge process that is running my HTML page. The html page URL is like this: [http://localhost:61028/WebResources/BulkAddress.html]

When I am hitting a button from my HTML page, it tries to debug code of C# in instance 2 of VS 2022. But at this stage, it throws error like this

Failed to launch debug adapter. Additional information may be available in the output window.

Cannot connect to the target at localhost:61803: Could not connect to debug target at http://localhost:61803: Could not find any debuggable target

In the error above, you can see it is mentioning port 61803 which is different from the actual HTML page running in Edge. Why is it taking a different port, even though I have attached the correct process for MS Edge with port 61028?

So, I am unable to debug my code. Any idea?

User's image

This is error I am facing when I press the button to debug

User's image

Thanks

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,858 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
966 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 29,266 Reputation points Microsoft Vendor
    2024-03-07T06:21:03.7833333+00:00

    Hello @Muhammad Fasih Akbar ,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    Please try to close your project and Visual Studio, navigate to your solution folder, find and remove/rename the hidden .vs folder then rebuild and run your project again, after that attach the debugger and check if this issue disappears.

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments