grpc-dotnet
gRPC for .NET
Overview
gRPC is a high-performance RPC framework that uses Protocol Buffers (protobuf) for service contracts and HTTP/2 for transport. In .NET, Grpc.AspNetCore hosts gRPC services inside ASP.NET Core, and Grpc.Net.Client provides a strongly-typed client. gRPC supports four communication patterns: unary (request-response), server streaming, client streaming, and bidirectional streaming.
gRPC is the preferred choice for internal service-to-service communication where strong typing, code generation, and streaming are more valuable than REST's human-readability. The .proto files serve as the single source of truth for the service contract, generating both server stubs and client proxies at build time.
Proto File Definition
Define the service contract in a .proto file. The protobuf compiler generates C# types and service stubs.
syntax = "proto3";
option csharp_namespace = "MyApp.Protos";
package orders;