Hey everyone,
Just a quick post on how to use postman with a gRPC endpoint using .net core.
Add the grpc reflection package to your project:
dotnet add package Grpc.AspNetCore.Server.Reflection
Add to the container and include the middleware in your program.cs
:
builder.Services.AddGrpc();
# Add this line.
builder.Services.AddGrpcReflection();
var app = builder.Build();
app.MapGrpcService<GreeterService>();
# Add this line.
app.MapGrpcReflectionService();
Startup your project and then open postman. Create a new gRPC request by:
- Clicking
file
>new
- Select
gRPC Request
(currently has a beta tag) - Enter your url e.g.
localhost:20257
- Click
Using server reflection Refresh
You should now be able to see your gRPC service listed to the right. Click the Invoke
button.
Thanks to the following links for the info: