VS 2022 Hot Reload - web socket fails to open in aspnetcore-browser-refresh.js

Viewed 4777

Reagrdless of whether I run the application with or without the debugger attached, and whether it's run from VS or via command line (dotnet watch run) I cannot get the Hot Reload websocket to connect.

The framework automatically adds the aspnetcore-browser-refresh.js file to my page, which attempts to open a websocket connection to a localhost port on machine, but it always fails.

I tried creating new blazor server project to see if the issue still happened...it did.

I am using Visual Studio 2022 and targeting .net 6. Both are up to date.

Has anyone else run into a similar issue and/or have any ideas to try to resolve?

3 Answers

It's a bug with VS2022 that should be addressed in the near future;

I bet you have 17.1.0 or 17.1.1;

As a workaround, you can uninstall Visual Studio 2022 17.1.0 version and install and older version; VS2019 also works but you might not get .net 6 with that.

I got the same error too when updating to 17.1.1. But I can overtake it by changing the version to preview via Visual Studio Installer. For this case i have update to 17.2.0 preview 2 and the error gone :) .

Sorry for my bad English.

Related