problem of aspnetcore-browser-refresh.js connection failed.

melon NG 291 Reputation points
2022-02-18T03:34:15+00:00

The version of my browser is Chrome 98.0.4758.102(The newest version of Chrome).

Every time I debug my asp.net 6 projects with VS 2022(The newest version of VS 2022), the browser always reports the error as below:
175652-image.png

This problem occurs even I create a blank new asp.net 6 project.

I searched and found it seems the chrome forbids this for safety.

And now the hot reload no works seems because of this.

How can I solve it? Thank you.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,793 questions
{count} votes

Accepted answer
  1. Zhi Lv - MSFT 33,151 Reputation points Microsoft External Staff
    2022-02-23T05:31:03.49+00:00

    Hi @melon NG ,,

    I have reproduced the problem, the issue relates the Visual Studio 2022 17.1 version.

    By using Visual Studio 2022 17.1.0 version, after running the application, even the web page can display well, if we check the F12 Console panel, we can see this error:

    176920-image.png

    This issue has been feedback to the Visual Studio forum: WebSocket connection to 'wss://...' failed. ASP .Net Core Web application. After update 17.1. You can also upvote it, and the Visual Studio team will review the feedback and notify you about the next steps.

    As a workaround, you can uninstall Visual Studio 2022 17.1.0 version and install a version before Visual Studio 2022 17.1.0, such as Visual Studio 2022 17.0.4 version (I checked this version, and this version has no Websocket connection error).


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    6 people found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Gianluca De Martino 5 Reputation points
    2023-04-23T00:27:42.9+00:00

    Same problem after implemented Areas

    1 person found this answer helpful.

  2. Haiyan Du 1 Reputation point
    2022-07-08T15:49:28.833+00:00

    This issue could cause by your project file *.csproj was created in Visual Studio 2019, now you are building it using visual studio 2022. Visual studio 2022 development team should take a look at this issue.

    0 comments No comments

  3. Werner Van Aswegen 0 Reputation points
    2025-03-07T21:09:35.6033333+00:00

    The issue still exists.

    I'm using Visual Studio Professional 2022 (64-bit) Version 17.12.5.

    I created a C# Asp.Net Core MVC app targeting .Net 8.0 (Long Term Support), no optional settings selected and ran it in debug without changing anything.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.