python gRPC DNS解析失败

huangapple go评论83阅读模式
英文:

python grpc DNS resolution failed

问题

我一直在尝试连接到一个托管在域名“example.com/server”后面的 gRPC 服务器。

我正在使用 grpc.secure_channel 来建立连接。然而,我遇到了错误消息 DNS 解析失败,example.com/server: 未知错误: 名称或服务未知。有趣的是,如果我将域名更改为只是“example.com”,连接就会正常工作。看起来 GRPC_DNS_RESOLVER 无法解析包含主机名后的目录路径的域名。

有人在之前遇到过这个问题吗,或者有任何关于如何解决它的建议吗?

英文:

I have been attempting to connect to a gRPC server hosted behind the domain name "example.com/server".

I am using grpc.secure_channel to establish the connection. However, I encounter the error message DNS resolution failed for example.com/server: UNKNOWN: Name or service not known. Interestingly, if I change the domain name to just "example.com", the connection works fine. It seems that the GRPC_DNS_RESOLVER is unable to resolve domain names that include a directory path after the hostname.

Has anyone encountered this issue before or have any suggestions on how to resolve it?

channel_credential = grpc.ssl_channel_credentials(crt.encode())
channel = grpc.secure_channel('example.com/server', channel_credential)
intercept_channel = grpc.intercept_channel(channel)
stub = project_pb2_grpc.MyStub(intercept_channel)
stub.task()

答案1

得分: 1

gRPC不使用路径,您只需提供服务器名称。

英文:

gRPC does not use paths, you should only provide the server name.

huangapple
  • 本文由 发表于 2023年6月15日 01:58:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76476355.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定