首页 > 解决方案 > .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).

我们尝试过的,

  1. AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

  2. 在启动时,我们使用 Kestrel 来监听 Http1,

    options.ListenLocalhost(5000, o => o.Protocols = HttpProtocols.Http1);

  3. 为证书和 SslProtocols 添加了 HttpClientHandler 配置

标签: node.js.net-coregrpcnest

解决方案


推荐阅读