'.NET 6.0 Blazor Server app: WebSocket connection to 'ws://localhost:60908/BlazorApp1/' failed
When I create a new, clean Blazor .NET 6.0 app and start it (using Visual Studio 2022), I see the following error in the browser console:
WebSocket connection to 'ws://localhost:60908/BlazorApp3/' failed: (aspnetcore-browser-refresh.js:234)
Does anyone else have this and any idea if this is a VS2022 bug and how to fix it?
Solution 1:[1]
The same issue has been discussed here https://developercommunity2.visualstudio.com/t/WebSocket-connection-to-wss:-fail/1670519?q=ERR_CONNECTION_RESET&ftype=problem&space=8&stateGroup=active&sort=newest and the fix is available with VS 17.2 Preview 2.1
Solution 2:[2]
I had exactly the same issue after installing Visual Studio 2022. I tried to "Enable WebSocket Protocol" but that didn't work. However, the fix for me was to change Script Debugging to "Enabled".
Hopefully, this can help you too.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jaish Mathews |
Solution 2 | Vitali Karmanov |