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