0

I have to create a Python Flask Service which loads an image from an URL and sends it to a C# GRPC Service. Both services have to run in Docker later. For now, I just want to run them on localhost. The server requires no authorization or credentials.

Now to my problem: My Python Client can't connect to my C# Server. I have tried switching the port, changing the IP adress, using an insecure and secure channel. This is my Python client code:

request = pb2.UploadDataRequest(FileType=filetype, data=data)
with grpc.insecure_channel('localhost:5001') as channel:
    stub = pb2_grpc.BlobStorageStub(channel)
    result = stub.Upload(request)

My C# Server runs on localhost:5001:

"applicationUrl": "https://localhost:5001",

This is my proto file:

syntax = "proto3";

option csharp_namespace = "GrpcGreeterClient";

package greet;

service BlobStorage {
  rpc Download (DownloadDataRequest) returns (DownloadDataResult);
  rpc Upload (UploadDataRequest) returns (UploadDataResult);
}

message DownloadDataRequest {
    string FileId = 1;
}

message DownloadDataResult {
    string FileType = 1;
    bytes data = 2;
}

message UploadDataRequest {
    string FileType = 1;
    bytes data = 2;
}

message UploadDataResult {
    string FileId = 1;
}

Both Services run on Windows 10.

I have a C# Test Client that can connect to the server just fine. Every help is appreciated.

  • Can you please post the error message you get out of the Python client? Also, can you provide context for your "applicationUrl" snippet above? "https" doesn't look like a correct prefix to supply to a channel builder for either a gRPC server or a gRPC client. – Richard Belleville Jan 27 '21 at 18:32
  • grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.UNAVAILABLE details = "failed to connect to all addresses" debug_error_string = "{"created":"@1611837802.304000000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":5391,"referenced_errors":[{"created":"@1611837802.304000000","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":398,"grpc_status":14}]}" > This is my errorMessage – Maximilian_von_Bomhard Jan 28 '21 at 12:43
  • The application URL is the base URL for my server. At this address I can call the service. – Maximilian_von_Bomhard Jan 28 '21 at 12:44
  • Can you verify that your server is in fact listening on port 5001? Use `netstat` or something similar. Can you connect to your server with a command line gRPC tool like grpcurl? – Richard Belleville Jan 28 '21 at 21:17

0 Answers0