首页 新闻 搜索 专区 学院

nginx + ocelot+.net core signalr 关于websocket无法正常握手的问题

0
悬赏园豆:200 [已解决问题] 解决于 2021-06-21 15:45

在发送post请求到 negotiate时,ocelot里提示
requestId: 0HM4FAJCPR76R:00000001, previousRequestId: no previous request id, message: Error Code: UnableToCompleteRequestError Message: Error making http request, exception: System.Net.Http.HttpRequestException: Resource temporarily unavailable ---> System.Net.Sockets.SocketException: Resource temporarily unavailable
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Ocelot.Requester.HttpClientHttpRequester.GetResponse(DownstreamContext context) errors found in ResponderMiddleware. Setting error response for request path:/kf/negotiate, request method: POST

整个项目的流程是这样的:
请求->nginx->ocelot->api+signalr
网上g了,stackoverflow也翻了,各种试了,看看有没有大神遇到过同样的问题

锋博的主页 锋博 | 初学一级 | 园豆:24
提问于:2020-11-23 10:13

确实是ocelot的版本不支持

锋博 5个月前
< >
分享
最佳答案
0

先直接connect到api, 在测试ocelot+api, 在测试nginx+ocelot+api, 总归是某个地方的设置有问题.

收获园豆:95
czd890 | 专家六级 |园豆:11904 | 2020-11-27 13:58

去掉ocelot是通的

锋博 | 园豆:24 (初学一级) | 2020-12-03 20:03

@锋博: 你的这个核心错误是 Resource temporarily unavailable 503 哎, 确定配置没问题哦

czd890 | 园豆:11904 (专家六级) | 2020-12-03 23:31

@czd890: 嗯,别的资源访问正常

锋博 | 园豆:24 (初学一级) | 2020-12-10 13:30
其他回答(3)
0
收获园豆:10
戎"码"一生 | 园豆:864 (小虾三级) | 2020-11-23 13:01
0

stackoverflow 上的这篇试过么?

 

https://stackoverflow.com/questions/63472028/ocelot-not-passing-websockets-to-microservice

收获园豆:95
小小高 | 园豆:1037 (小虾三级) | 2020-11-24 16:37

谢谢回复,我的中间件启用顺序是正确的

支持(0) 反对(0) 锋博 | 园豆:24 (初学一级) | 2020-11-24 18:38
0

确实是ocelot的版本不支持

锋博 | 园豆:24 (初学一级) | 2021-06-21 15:44
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册