Using Postman with .net gRPC endpoints

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:

System.IO.IOException with a .NET gRPC Project on Mac

Hey everyone,


I created a new gRPC project with Visual Studio on a Mac and ran into the following error when trying to run it:

System.IO.IOException
...
http/2 over tls is not supported on macos due to missing alpn support

It turns out that Kestrel does not support HTTP/2 with TLS on MacOS. In order to get around it we end up having to configure it to not use TLS.

In program.cs, add the lines below with your HTTP port (e.g. 20257):

var builder = WebApplication.CreateBuilder(args);

builder.WebHost.ConfigureKestrel(options =>
{
    // Setup a HTTP/2 endpoint without TLS.
    options.ListenLocalhost(20257, o => o.Protocols =
        HttpProtocols.Http2);
});

Thanks to the following links for the info: