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.
question from:
https://stackoverflow.com/questions/65920476/calling-grpc-server-from-python-client 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…