0

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.

  1. Does grpc only have to run with HTTPS?
  2. Doeschat.proto files for both the client and server should be identical? Even the C# namespace?
1
  • 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). Commented Feb 3 at 21:35

1 Answer 1

0

GRPC 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.