Building a gRPC service and client
Let’s see an example service and client for sending and receiving simple messages.
Building a Hello World gRPC service
We will start by building the gRPC service using one of the project templates provided as standard:
- Use your preferred code editor to create a new project, as defined in the following list:
- Project template: ASP.NET Core gRPC Service/
grpc
- Workspace/solution file and folder:
Chapter12
- Project file and folder:
Northwind.Grpc.Service
For working with
.proto
files in Visual Studio Code, you can install the extension vscode-proto3 (zxh404.vscode-proto3
). - Project template: ASP.NET Core gRPC Service/
- In the
Protos
folder, ingreet.proto
, note that it defines a service namedGreeter
with a method namedSayHello
that exchanges messages namedHelloRequest
andHelloReply
, as shown in the following code:syntax = "proto3"; option csharp_namespace = "Northwind.Grpc...