Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 643
olesakn Avatar asked Jan 28 '26 15:01

olesakn


2 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.

like image 195
Dan M Avatar answered Jan 31 '26 20:01

Dan M


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.

like image 34
Sigit Budi Avatar answered Jan 31 '26 18:01

Sigit Budi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!