使用AddGrpcClient扩展创建gRPC客户端时出现Bad gRPC response错误的问题求助
使用AddGrpcClient扩展创建gRPC客户端时出现Bad gRPC response错误的问题求助
我遇到一个挺困惑的问题,当我通过AddGrpcClient扩展方法来注册并创建gRPC客户端时,总是会抛出下面这个异常:
builder.Services.AddGrpcClient<MyClient>(options => options.Address = new Uri("https://localhost:50051"));
Grpc.Core.RpcException: 'Status(StatusCode="Internal", Detail="Bad gRPC response. Response protocol downgraded to HTTP/1.1.")'
可是如果我手动创建客户端,代码写成下面这样的话,就能顺利发起请求并且成功拿到结果:
using var channel = GrpcChannel.ForAddress("https://localhost:50051"); MyClient client = new(channel);
我实在搞不清哪里出问题了,有没有朋友能帮我分析一下?
备注:内容来源于stack exchange,提问作者Eduardo Brites
相关产品推荐
相关产品推荐

