gRP C HelloWorld - Ошибка при отправке сообщения на ASP. NET Главный сервер с Python клиента - PullRequest
0 голосов
/ 04 февраля 2020

Я настроил ASP. NET Core client, используя это Учебное пособие: Создайте клиент и сервер gRP C в ASP. NET Core

Моя конечная точка находится в https://localhost: 5001 И из того, что я прочитал в документации , говорится:

"Конечные точки Kestrel, используемые для gRP C должен быть защищен с помощью TLS. В процессе разработки конечная точка, защищенная с помощью TLS, автоматически создается в https://localhost: 5001 при наличии ASP. NET сертификата разработки ядра "

В моем python коде у меня есть

"""The Python implementation of the GRPC helloworld.Greeter client."""

from __future__ import print_function
import logging

import grpc

import greet_pb2
import greet_pb2_grpc


def run():
    # NOTE(gRPC Python Team): .close() is possible on a channel and should be
    # used in circumstances in which the with statement does not fit the needs
    # of the code.
    with grpc.insecure_channel('https://localhost:5001') as channel:
        stub = greet_pb2_grpc.GreeterStub(channel)
        response = stub.SayHello(greet_pb2.HelloRequest(name='you'))
    print("Greeter client received: " + response.message)


if __name__ == '__main__':
    logging.basicConfig()
    run()

Но когда я его запускаю, я получаю эту ошибку

Traceback (most recent call last):
  File "greet_client.py", line 37, in <module>
    run()
  File "greet_client.py", line 31, in run
    response = stub.SayHello(greet_pb2.HelloRequest(name='you'))
  File "D:\Anaconda\lib\site-packages\grpc\_channel.py", line 824, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "D:\Anaconda\lib\site-packages\grpc\_channel.py", line 726, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "DNS resolution failed"
        debug_error_string = "{"created":"@1580765368.309000000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3941,"referenced_errors":[{"created":"@1580765368.309000000","description":"Resolver transient failure","file":"src/core/ext/filters/client_channel/resolving_lb_policy.cc","file_line":262,"referenced_errors":[{"created":"@1580765368.309000000","description":"DNS resolution failed","file":"src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc","file_line":202,"grpc_status":14,"referenced_errors":[{"created":"@1580765368.309000000","description":"OS Error","file":"src/core/lib/iomgr/resolve_address_windows.cc","file_line":96,"os_error":"No such host is known.\r\n","syscall":"getaddrinfo","wsa_error":11001}]}]}]}"
...