【发布时间】:2021-05-04 14:42:05
【问题描述】:
我正在尝试从 React 应用程序连接到 Ocelot Api 网关后面的 SignalR 集线器。但是,这样做时我收到以下错误:
Unhandled Rejection (Error):
new HttpError
index.js:1 [2021-01-31T02:42:31.498Z] Error: Failed to complete negotiation with the server: Error
index.js:1 [2021-01-31T02:42:31.498Z] Error: Failed to start the connection: Error
Uncaught (in promise) Error
at new HttpError (Errors.ts:20)
at FetchHttpClient.<anonymous> (FetchHttpClient.ts:116)
at step (FetchHttpClient.ts:2)
at Object.next (FetchHttpClient.ts:2)
at fulfilled (FetchHttpClient.ts:2)
我已阅读 Ocelot 在 SignalR/WS (https://ocelot.readthedocs.io/en/latest/features/websockets.html) 上的文档,并确保请求在我的 ocelot.json 中按照应有的方式进行路由:
{
"DownstreamPathTemplate": "/notificationhub",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7001
}
],
"UpstreamPathTemplate": "/notifications",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ]
},
怎么了?
【问题讨论】:
标签: c# reactjs signalr asp.net-core-signalr ocelot