最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

authentication - Need help to fix communication using GRPC - between client and server - Stack Overflow

programmeradmin0浏览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?

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?
Share Improve this question asked Feb 3 at 21:01 Abbas HussainAbbas Hussain 12 bronze badges 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). – DazWilkin Commented Feb 3 at 21:35
Add a comment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论