Error with WebSocket

Nordin van der leije 31 Reputation points
2022-02-18T08:43:21.06+00:00

Hello I get the error: WebSocket connection to 'wss://localhost:54970/Dashboard.Server/' failed: Error in connection establishment: net::ERR_CONNECTION_RESET.

I get this on a new project, so what I do is

Start Visual Studio 2022.

Make a new Blazor WebAssembly App.

Set the framework to 6.0 with no Authentication type and the option Configure for HTTPS and ASP.NET Core hosted checked.

Then I run the Application with ISS Express.

Crome gives the error: WebSocket connection to 'wss://localhost:54970/Dashboard.Server/' failed: Error in connection establishment: net::ERR_CONNECTION_RESET.

I have no other programs or services running that could be interfering with the application, what am I doing wrong?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,442 questions
{count} votes

Accepted answer
  1. Zhi Lv - MSFT 32,051 Reputation points Microsoft Vendor
    2022-02-23T05:26:55.923+00:00

    Hi @Nordin van der leije ,

    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:

    177045-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

    1 person found this answer helpful.

6 additional answers

Sort by: Most helpful
  1. Spyros Botsis 6 Reputation points
    2022-02-18T15:48:13.947+00:00

    It started to happen for me as after updating to 17.1.0

    1 person found this answer helpful.
    0 comments No comments

  2. Michael Washington 911 Reputation points MVP
    2022-02-18T16:34:23.757+00:00

    I cannot reproduce your error. However, I did create a project, using your process, that does work on my machine. Perhaps you can see if it works for you? https://github.com/ADefWebserver/BlazorSimpleSurvey/files/8098792/BlazorWebAssembly.zip

    1 person found this answer helpful.

  3. Ody Quraviharto 1 Reputation point
    2022-04-16T05:17:19.33+00:00

    please take your time to release visual studio and .net sdk in more relax timeline.
    let's say release is every 6 months, aim to high quality release.
    the product is not intended for critical production involving death-or-alive of people, so please be relax releasing your product.

    0 comments No comments

  4. Caslav Mitic 1 Reputation point
    2022-06-03T11:59:47.283+00:00

    Hi, same issue here.
    I updated VS 2022 from 17.1 to 17.2.3 and no more WebSocket error :)

    0 comments No comments