dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.43k stars 10.01k forks source link

Running Blazor wasm on a domain other than localhost breaks the debugger. #35035

Closed deadcast2 closed 11 months ago

deadcast2 commented 3 years ago

Issue

I'm having a difficult time trying to get my new Blazor wasm project to utilize a hostname other than localhost. When I change the hostname the debugger suddenly stops working in Chrome (Version 92.0.4515.107). I've been able to reproduce this issue very easily with creating a new Blazor wasm project to test. I'm seeing an error saying "ProtocolException: Exception of type 'Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.ProtocolException' was thrown." in my DebugAdapterHost-jsdebug.log file.

Reproduction

  1. Create new Blazor wasm project with Configure for HTTP unchecked, ASP.NET Core Hosted checked and Progressive Web Application checked.
  2. Run new application to see debugger works great.
  3. Now close and change the App Url in the Debug properties of the project to say debuggertest.com:portnumber. I'm using debuggertest.com:50888 since I added an entry for debuggertest.com into my hosts file to point to 127.0.0.1 at C:\Windows\System32\drivers\etc\hosts Capture
  4. Next register the new url so it has permission to register with IIS Express: netsh http add urlacl url=http://debuggertest.com:50888/ user=yourusername
  5. Start the application and notice that nothing appears in the browser window and eventually this error will show Capture2

Also you should get this error in your DebugAdapterHost-jsdebug.log file:

Failure Location: LaunchRequest
    Inner Exception: 
        ProtocolException: Exception of type 'Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.ProtocolException' was thrown.

 1> 08/04/2021 08:35:38.984: ERROR: One or more errors occurred.

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

Unable to launch browser: "Could not open ws://debuggertest.com:50888/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A7336%2Fdevtools%2Fbrowser%2Fe5ad596d-ea8d-4579-906b-75e59e787c5a"
 1> 08/04/2021 08:35:38.987: [DebugAdapter] <--   E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/error","data":{"!error":{"error":{"message":"WebSocket was closed before the connection was established","name":"Error","stack":"Error: WebSocket was closed before the connection was established\n    at E.close (websocket.js:220:14)\n    at webSocketTransport.js:50:16"}},"error":{"error":{"message":"WebSocket was closed before the connection was established","name":"Error","stack":"Error: WebSocket was closed before the connection was established\n    at E.close (websocket.js:220:14)\n    at webSocketTransport.js:50:16"}},"exceptionType":"unhandledRejection"}},"seq":9}
 1> 08/04/2021 08:35:40.987: Debug adapter process exited.

My Visual Studio 2019 version is 16.10.4 and here are my installed package versions:

Microsoft Visual Studio Community 2019
Version 16.10.4
VisualStudio.16.Release/16.10.4+31515.178
Microsoft .NET Framework
Version 4.8.03761

Installed Version: Community

.NET Core Debugging with WSL 2   1.0
.NET Core Debugging with WSL 2

ASP.NET and Web Tools 2019   16.10.526.50910
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019   16.10.526.50910
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.10.526.50910
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   16.10.526.50910
Azure Functions and Web Jobs Tools

BusinessObjectEditor   1.0
Information about my package

C# Tools   3.10.0-4.21329.37+246ce641f04b67ef017655275d850bf902a8e40f
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CodeRush for Roslyn   21.1.5.0
DevExpress CodeRush for Roslyn package.

CodeRush for Roslyn Tool Windows   21.1.5.0
DevExpress CodeRush for Roslyn Tool Windows package.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

ConvertToDevExtremeCommand Extension   1.0
ConvertToDevExtremeCommand Visual Studio Extension Detailed Info

CreateLayoutWizard   1.0
Create layout wizard.

DevExpress Reporting Extension   1.3
A Visual Studio extension that invokes the Report Designer editor for report definition VSREPX files.

DevExpress Reporting Tools Extension   1.0
Extends Visual Studio with tools required for the Report Designer editor.

DevExpress.DeploymentTool   1.0
A useful tool for deploying DevExpress assemblies.

DevExpress.ExpressApp.Design.DynamicPackage   1.0
DevExpress VSIX Package

DevExpress.ExpressApp.DesignPackage   1.0
DevExpress VSIX Package

DevExpress.Win.LayoutAssistant Extension   1.0
DevExpress.Win.LayoutAssistant Visual Studio Extension Detailed Info

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.40423.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

NuGet Package Manager   5.10.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Razor (ASP.NET Core)   16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   16.0.62106.24090
Microsoft SQL Server Data Tools

TypeScript Tools   16.0.30429.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.10.0-4.21329.37+246ce641f04b67ef017655275d850bf902a8e40f
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.10.0-beta.21262.7+1b23bbeda88ea3cb9be9af777f4c99fa8663df81
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

If you need anymore information from me please let me know. Thank you.

ghost commented 3 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

mkArtakMSFT commented 11 months ago

Hi. Thanks for contacting us. We're closing this issue as there was not much community interest in this ask for quite a while now. You can learn more about our triage process and how we handle issues by reading our Triage Process writeup.