Ocelot动态路由如何配置运行signalR连接?

weixin_38059973 2019-02-21 09:34:29
Ocelot动态路由和Consul时,Signalr无法成功连接。如何配置多个DownstreamScheme同时运行http和ws访问呢? ··· { "ReRoutes": [], "Aggregates": [], "GlobalConfiguration": { "BaseUrl": null, "RequestIdKey": null, "ServiceDiscoveryProvider": { "Host": "192.168.2.88", "Port": 8500, "Type": "Consul", "Token": null, "ConfigurationKey": null }, "RateLimitOptions": { "ClientIdHeader": "ClientId", "QuotaExceededMessage": null, "RateLimitCounterPrefix": "ocelot", "DisableRateLimitHeaders": false, "HttpStatusCode": 9999 }, //"QoSOptions": { // "ExceptionsAllowedBeforeBreaking": 0, // "DurationOfBreak": 0, // "TimeoutValue": 0 //}, "UpstreamHeaderTransform": { "X-Forwarded-For": "{RemoteIpAddress}" }, "LoadBalancerOptions": { "Type": "RoundRobin", //负载均衡规则 "Key": null, "Expiry": 0 }, "DownstreamScheme": "http", "HttpHandlerOptions": { "AllowAutoRedirect": false, "UseCookieContainer": false, "UseTracing": false } } } ···
...全文
420 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38096743 2019-03-02
  • 打赏
  • 举报
回复
现在阶段的版本好像是不支持在动态路由中同时配置http和ws.
weixin_38095580 2019-02-22
  • 打赏
  • 举报
回复
根据官方文档 https://ocelot.readthedocs.io/en/latest/features/websockets.html 需要现在 Startup 中启用 websockets Configure(app => { app.UseWebSockets(); app.UseOcelot().Wait(); }) 然后再配置 { "ReRoutes": [ { "DownstreamPathTemplate": "/{catchAll}", "DownstreamScheme": "ws", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 50000 } ], "UpstreamPathTemplate": "/gateway/{catchAll}", "UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ] } ]

474

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧