DotNet gRPC Getting Started
07/17/2022
In the this series of posts I will look into the details of gRPC in ASP.NET Core. In this first post I will be creating a simple service and a corresponding client. In future posts I will focus on the internal implementation of ASP.NET Core's gRPC extension. gRPC (gRPC Remote Procedure Calls is an open source remote procedure call implementation that is based on modern (web) standards. gRPC leverages HTTP2 as transport protocol, and uses Protocol Buffer as a data format and interface definition language. It is typically used for back channel (service-to-service) communication due to its efficiency. However, the efficiency comes at a cost: debugging/decoding messages are not as straightforward as with other protocols.
Creating a gRPC Service
This post provides a getting started and a look into the internals of Grpc.AspNetCore nuget package. The official documentation is spot on to get started:
create a proto file: the proto file defines the messages exchanged by server and the client as well as the operations that a client may invoke on a server
create a new asp.net core project (using dotnet CLI:
dotnet new webapp
)add Grpc.AspNetCore nuget package to the project (
dotnet add package Grpc.AspNetCore
)add the proto file as a Server gRPC service