node.js - .NetCore gRPC 客户端无法使用 NestJs gRPC 服务器调用 Node
问题描述
我们在 NodeJs 中有一个 gRPC 服务器,Nest 在单独的端口 3001 上运行,当我们从 Node 客户端调用它时,它工作正常。但是当我们尝试调用它时,我们的一个微服务位于 .NETCore 中,会出现以下错误。目前,我们停留在 3,4 点。如果有人可以指导我们,那将非常有帮助。
1. Status(StatusCode="Unimplemented", Detail="The server does not implement the method", ResponseCode: "404")
2. Status(StatusCode="Internal", Detail="Bad gRPC response. Response protocol downgraded to HTTP/1.1.")
3. An error occurred while sending the request. Http2ConnectionException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1).
4. An error occurred while sending the request. IOException: The request was aborted. Http2ConnectionException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1).
我们尝试过的,
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
在启动时,我们使用 Kestrel 来监听 Http1,
options.ListenLocalhost(5000, o => o.Protocols = HttpProtocols.Http1);
为证书和 SslProtocols 添加了 HttpClientHandler 配置
解决方案
推荐阅读
- idris - 如何使用来自 Maybe 的数据作为 Vect 大小变量
- keras - Tensorflow:自定义损失函数以鼓励/限制误报/否定
- reactjs - 从 switch 语句反应返回视图
- docker - Docker 中的 Azure DevOps 代理:添加自定义功能
- haskell - 如何链接以获取餐厅名称
- c - 系统调用 read() 被阻塞
- azure-backup-vault - MARS 备份(系统状态)备份失败 - Windows server 2012
- laravel - 在 Laravel 5.8 迁移中,无法将外部列从可为空更改为不为空
- sql - 子查询应该总是选择语句吗?
- oracle - 如何通过更改计数值在 Oracle 中按组填写缺失的日期