SignalR为什么抛出一个没有提供任何信息的错误?

huangapple go评论72阅读模式
英文:

Why is SignalR throwing an error that doesn't provide any information?

问题

I can provide a translation of the non-code part:

在SignalR中出现以下错误。

不应该抛出任何错误。我们没有收到任何错误消息。它只说出现了错误。但是关于出现了什么错误呢?

错误:无法启动传输'WebSockets':错误:出现传输错误。错误:无法启动传输'ServerSentEvents':错误:发生错误。错误:带有错误'Error'的连接断开连接。错误:无法启动传输'LongPolling':错误signalr.js:4741 WebSocket连接至'wss://tst.com/SignalRHub?id=ujZbbgfwN2nbPvjGTIpGBw'失败:[2023-05-22T12:36:24.679Z] 错误:无法启动连接:错误:无法连接到任何可用的传输方式。WebSockets失败:错误:出现传输错误。ServerSentEvents失败:错误:发生错误LongPolling失败:错误

所有错误同时发生。

不应该抛出任何错误。

英文:

Getting below errors in SignalR.

It should not throw any errors. We are not getting any Error messages. It only says Error. But what not about what error occurred?

SignalR为什么抛出一个没有提供任何信息的错误?

> Error: Failed to start the transport 'WebSockets': Error: There was an
> error with the transport. Error: Failed to start the transport
> 'ServerSentEvents': Error: Error occurred Error: Connection
> disconnected with error 'Error'. Error: Failed to start the transport
> 'LongPolling': Error signalr.js:4741 WebSocket connection to
> 'wss://tst.com/SignalRHub?id=ujZbbgfwN2nbPvjGTIpGBw' failed:
> [2023-05-22T12:36:24.679Z] Error: Failed to start the connection:
> Error: Unable to connect to the server with any of the available
> transports. WebSockets failed: Error: There was an error with the
> transport. ServerSentEvents failed: Error: Error occurred LongPolling
> failed: Error

new signalR.HubConnectionBuilder()
  .withUrl(window.location.origin+\"/SignalRHub\", { skipNegotiations: true})
  .withAutomaticReconnect([0, 0, 10000])
  .configureLogging(signalR.LogLevel.Information)
  .build()

All errors are coming at the same time.

It should not throw any errors.

答案1

得分: 0

根据您的描述和评论,有时它可以工作,所以我相信在这种情况下没有代码问题。

您可以首先查看官方文档以检查404错误。

解决连接错误 - 响应代码404

我们可以正确启用粘性会话来解决此问题

英文:

According your description and comment, it sometime works, so I believe there is no code issue in this case.

You can follow the official doc to check the 404 error first.

Troubleshoot connection errors - Response code 404

We can enable sticky sessions correctly to fix the issue.

huangapple
  • 本文由 发表于 2023年5月22日 20:44:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76306335.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定