【发布时间】:2022-02-26 20:07:11
【问题描述】:
我目前正在运行一个带有 ASP.NET Core 3.1 的网络服务器和一个 Blazor 项目。 最近在升级到 .NET 6.0 时,我遇到了一些问题(即使是一个空白的 Blazor 项目),只有在我的网络服务器上部署时,浏览器中的 websocket 错误消息才会出现一些问题(请参阅下面的消息)。
本地(在 Windows 11 x64,VS 22 Preview 4 上)没有错误消息...
网络服务器:已安装 Debian 10 x64、.NET 6.0 SDK,在 NGINX 上运行并启用了 websockets(反向代理)。
我错过了什么,还是 .NET 6.0 和 NGINX 的当前状态存在问题?我已经尝试在 debian 服务器上本地访问网页,并且出现相同的错误消息。
我们将不胜感激!
您好!
订单中的错误消息:
Information: Normalizing '_blazor' to 'http://192.168.178.35/_blazor'.
blazor.server.js:1 WebSocket connection to 'ws://192.168.178.35/_blazor?id=wnPt_fXa9H4Jpia530vPWQ' failed:
Information: (WebSockets transport) There was an error with the transport.
Error: Failed to start the transport 'WebSockets': Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.
Warning: Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection. To troubleshoot this, visit https://aka.ms/blazor-server-using-fallback-long-polling.
【问题讨论】:
-
您是总是收到错误信息还是只是有时?
-
总是和它总是一样的。
-
看起来像 NGINX 配置问题。不是我的地区。但它允许非 SSL 吗?
-
好问题,我去看看。非 SSL 有问题吗?通常我会将所有内容都转发到 SSL。
-
我查了一下,SSL 和非 SSL 都可用。问题仍然存在。