Reputation: 1450
I've got the following "hello world" gRPC serivice working in a c#, VS 2022 console client calling both http and https endpoints; but I get errors when using Postman for Windows (ver 9.21.3) calling the same endpoints.
proto:
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply);
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings.
message HelloReply {
string message = 1;
}
post http://localhost:5046/Greeter/SayHello
body > raw > {"Name" : "testing grpc http"}
postman response -> "Parse Error: The server returned a malformed response"
postman console -> "Error: Parse Error: Expected HTTP/" c# grpc server console -> none
post https://localhost:7046/Greeter/SayHello
body > raw > {"Name" : "testing grpc HTTPS"} postman response -> "Error: socket hang up"
c# grpc server console -> "HTTP/2 over TLS was not negotiated on an HTTP/2-only endpoint."
Anyone having success with the c#/VS2022/Postman stack?
UPDATE
I'm now creating my request via the link posted by @LaurentGabiot here: https://blog.postman.com/postman-now-supports-grpc/
and am now getting the same error for both of my http/https endpoints:
"Error: Invalid protocol: https"
In their sample, their endpoints are: "grpcb.in:9000" whatever that means. Not sure how to do that in Vs2022/c#.
Note: I'm leaving my original errors (above) in case someone else creates their request the same way that I did.
Upvotes: 2
Views: 5819
Reputation: 182
Just type the URL without scheme as the server URL, i.e. localhost:5046
.
Upvotes: 2