go
network_error
ai_generated
true
rpc 错误:代码 = Unavailable 描述 = 连接错误:描述 = "传输:拨号时出错:拨号 tcp 127.0.0.1:50051:连接被拒绝"
rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:50051: connect: connection refused"
ID: go/grpc-connection-refused
80%修复率
90%置信度
0证据数
2024-07-19首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.7 | active | — | — | — |
根因分析
服务器未运行或端口未开放。
English
Server is not running or the port is not open.
解决方案
-
100% 成功率
lis, _ := net.Listen("tcp", ":50051"); s := grpc.NewServer(); pb.RegisterGreeterServer(s, &server{}); s.Serve(lis) -
90% 成功率
Ensure client dials the correct address: grpc.Dial("localhost:50051", grpc.WithInsecure())
无效尝试
常见但无效的做法:
-
90% 失败
The server is not listening on any port.
-
50% 失败
Firewall is not the issue if the server is not running.