Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 895 Bytes

File metadata and controls

39 lines (24 loc) · 895 Bytes

NKZSoft.Service.Configuration.Grpc

Nuget

This library contains the following components:

  • Global error handlers

Global error handlers

Any exception on the server side is converted to an inner exception in RpcException with a populated Message field.

Using

On the server side:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGrpcServer();

var app = builder.Build();

app.MapGrpcEndpoints<TestService>();

app.Run();

On the client side:

var grpcChannel =  GrpcChannel.ForAddress(client.BaseAddress!, new GrpcChannelOptions
{
    HttpClient = client,
});
var callInvoker = grpcChannel.Intercept(new GrpcClientExceptionInterceptor());
callInvoker.CreateGrpcService<T>();