Cannot connect Python client and API.NET code server from samples

227 views
Skip to first unread message

Xavier Fornari

unread,
Jan 31, 2023, 3:52:48 AM1/31/23
to grpc.io
Hello,

I started to learn gRPC and try the tutorial with C# and Python from documentation
* C# sample
*  Python: sample

Both work perfectly separately, but when I try to have the Python client connected to
the C# server I got the error:

grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses; last error: UNAVAILABLE: ipv4:127.0.0.1:5001: WSA Error"
        debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: UNAVAILABLE: ipv4:127.0.0.1:5001: WSA Error {grpc_status:14, created_time:"2023-01-31T08:29:07.80283569+00:00"}"

I looked over the net and did not find any answer to this (only this similar thread on Stackoverflow

I have this python code:

    port=5001
    target=f'127.0.0.1:{port}'
    with grpc.secure_channel(target, grpc.ssl_channel_credentials()) as channel:
        stub = helloworld_pb2_grpc.GreeterStub(channel)
        response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))

while the server is properly listening: 

     info: Microsoft.Hosting.Lifetime[14]
          Now listening on: https://localhost:5001


Reply all
Reply to author
Forward
0 new messages