为什么名称解析无法从一个应用程序失败,而在另一个应用程序却失败?

时间:2019-03-08 06:37:26

标签: c# networking grpc

我正在使用计算机名称作为主机名在本地计算机上启动gRPC服务器:

new ServerPort("MyMachine", 9017, ServerCredentials.Insecure),

我正在通过Visual Studio运行此服务器代码。然后,我也可以通过运行客户端应用程序(也可以从VS)连接到该gRPC端点:

var channel = new Channel("MyMachine: 9017", ChannelCredentials.Insecure);

我可以成功调用一个简单的“ ping” API。我也可以telnet MyMachine 9017没有错误。

但是,当我尝试从另一个应用程序(LINQPad)连接时,出现错误消息:

RpcException: Status(StatusCode=Unavailable, Detail="Name resolution failure")

“通道,api,握手器,op_failure”的gRPC跟踪如下:

I0308 16:34:56.919349 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\init.cc:155: grpc_init(void)
I0308 16:34:56.919349 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\ext\transport\chttp2\client\insecure\channel_create.cc:91: grpc_insecure_channel_create(target=MyMachine:9017, args=00000208CD5C3D60, reserved=0000000000000000)
I0308 16:34:56.919349 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\channel.cc:285: grpc_channel_get_target(channel=00000208CD6D47C0)
I0308 16:34:58.578574 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc:1905: grpc_call_start_batch(call=00000208CD6F6020, ops=0000003041F7C790, nops=6, tag=00000208CD6BC440, reserved=0000000000000000)
I0308 16:34:58.578574 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc:1511: ops[0]: SEND_INITIAL_METADATA(nil)
I0308 16:34:58.578574 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc:1511: ops[1]: SEND_MESSAGE ptr=00000208CD541EC0
I0308 16:34:58.578574 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc:1511: ops[2]: SEND_CLOSE_FROM_CLIENT
I0308 16:34:58.578574 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc:1511: ops[3]: RECV_INITIAL_METADATA ptr=00000208CD6BC478
I0308 16:34:58.578574 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc:1511: ops[4]: RECV_MESSAGE ptr=00000208CD6BC490
I0308 16:34:58.578574 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc:1511: ops[5]: RECV_STATUS_ON_CLIENT metadata=00000208CD6BC498 status=00000208CD6BC4B0 details=00000208CD6BC4B8
I0308 16:34:58.588581 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\completion_queue.cc:699: cq_end_op_for_next(cq=00000208CD5815A0, tag=00000208CD6BC440, error="No Error", done=00007FF849B55C60, done_arg=00000208CD6F6F20, storage=00000208CD6F6F70)
I0308 16:34:58.588581 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\completion_queue.cc:1059: RETURN_EVENT[00000208CD5815A0]: OP_COMPLETE: tag:00000208CD6BC440 OK
I0308 16:34:58.588581 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\completion_queue.cc:959: grpc_completion_queue_next(cq=00000208CD5815A0, deadline=gpr_timespec { tv_sec: 9223372036854775807, tv_nsec: 0, clock_type: 1 }, reserved=0000000000000000)
I0308 16:34:58.618583 0 T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc:562: grpc_call_unref(c=00000208CD6F6020)

它的字面意思是“没有错误”,所以我对这里发生的事情感到非常困惑。谁能告诉我为什么从VS运行时可以连接,但不能从外部运行?

0 个答案:

没有答案