2022-10-27

VS Code - Cannot debug blazor wasm client projetc : Unable to lauch browser "The URL's protocol must be one of ws, wss or ws+inix"

I have downloaded the Samples to accompany the official Microsoft Blazor documentation

https://github.com/dotnet/blazor-samples

In VS Code then I open the folder

..\blazor-samples-main\6.0\BlazorSample_WebAssembly

I let VS Code add the assets in the subfolder .vscode launch.json task.json

I have modified the launch.json to be

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Launch and Debug Standalone Blazor WebAssembly App",
        "type": "blazorwasm",
        "request": "launch",
        "cwd": "${workspaceFolder}",
        "url": "https://localhost:5001"
    }
]}

and I have modified the launchSettings.json located in the Properties folder to be

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:57953",
      "sslPort": 44307
    }
  },
  "profiles": {
    "blazorwasm": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "BlazorSample": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

I then run the Run > Start Debugging F5 but I get the error described in the title and captured in the screenshots

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Has anyone ever encountered this problem in Visual Studio Code and knows how to fix it? Have I missed anything or done anything wrong? The same exact code with the blazorwasm configuration can be debugged successfully on Visual Studio 2022 but it fails as illustrated in Visual Studio Code and I do not understand why?

Some references I have used are below but I have not been able to understand the meaning of the error message below. I have tried to use Edge by switching the type in the blazorwasm but that causes Edge to crash right off the bat.

Unable to lauch browser "The URL's protocol must be one of ws, wss or ws+inix"

https://learn.microsoft.com/en-us/aspnet/core/blazor/debug?view=aspnetcore-6.0&tabs=visual-studio-code#debug-a-standalone-blazor-webassembly-app

https://dev.to/sacantrell/vs-code-and-blazor-wasm-debug-with-hot-reload-5317



No comments:

Post a Comment