I'm trying to establish connection between client and server using grpc. I'm doing the .proto file approach. I have couple of questions on this.
- Does grpc only have to run with HTTPS?
- Doeschat.proto files for both the client and server should be identical? Even the C# namespace?
I'm trying to establish connection between client and server using grpc. I'm doing the .proto file approach. I have couple of questions on this.
- Does grpc only have to run with HTTPS?
- Doeschat.proto files for both the client and server should be identical? Even the C# namespace?
- TLS (HTTPS) is preferred and often the default when using gRPC but it's not a requirement. I'm unsure which language implementations permit using non-TLS aka "insecure" (also h2c) but Go and Rust do support insecure. Protobuf files use namespaces for the Proto resources (e.g. Messages, Services) but the protobuf namespaces aren't directly represented in language implementations (probably to avoid the complexity that would result). That said, you should share compiled "stubs" between clients and servers (including the e.g. C# namespace). – DazWilkin Commented Feb 3 at 21:35
1 Answer
Reset to default 0GRPC can run without HTTPS in ASP.NET from the server side. It can also run without TLS on the client.
In your kestrel config you can do the following to force it to run without TLS on a specific port:
builder.WebHost.UseKestrel(x =>
{
x.ListenAnyIP(18940, options =>
{
options.Protocols = HttpProtocols.Http2;
}
}
For the client according to the code in my current project, no special configuration is needed.
As for the models, the namespace should match on the .proto file. I recommend building the shared proto models in a shared class library.