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

.NET 8迁移后gRPC无法通过HTTP/2连接,求排查配置问题

.NET Core 8迁移后HTTP/2(gRPC)服务异常问题

问题场景

将API服务器从.NET Core 7迁移至.NET Core 8后,原本正常运行的HTTP/2(gRPC)服务停止工作。此前在.NET Core 7中生效的Kubernetes环境变量配置如下:

- name: ASPNETCORE_Kestrel__Endpoints__Grpc__Url           
  value: http://*:5762         
- name: ASPNETCORE_Kestrel__Endpoints__Grpc__Protocols           
  value: Http2         
- name: ASPNETCORE_Kestrel__Endpoints__Http__Url           
  value: http://*:80         
- name: ASPNETCORE_Kestrel__Endpoints__Http__Protocols           
  value: Http1         
- name: ASPNETCORE_URLS           
  value: http://+:80;http://+:5762

针对.NET Core 8的默认端口变更,额外添加了以下配置:

- name: ASPNETCORE_HTTP_PORTS           
  value: "80;5762"

客户端请求时被重定向至HTTP/1.1,抛出异常:

Exception Info: Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Request protocol 'HTTP/1.1' is not supported.")

问题排查结论

经确认,上述所有.NET Core相关的环境变量配置均无错误,故障原因出在Kubernetes的路由设置上,并非.NET Core 8的配置遗漏。


内容的提问来源于stack exchange,提问作者Hasanuzzaman

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 17:52:12