You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 09:08:02