问题描述
我正在尝试从 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" ]
},
怎么了?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)