Skip to content

Grpc: Services

ronimizy edited this page Feb 10, 2024 · 3 revisions

General

Use AddPlatformGrpcServices extension method on IServiceCollection to configure gRPC services located on your server. This extension will register grpc and grpc server reflection in DI.

collection.AddPlatformGrpcServices();

Samples

Interceptors

You can configure interceptors for your services by passing a delegate to AddPlatformGrpcServices and calling AddInterceptor on provided builder.

collection.AddPlatformGrpcServices(services => services
    .AddInterceptor<SampleServiceInterceptor>());

Header handlers

You can register a handler that process header on each incoming request via implementing IPlatformGrpcHeaderHandler interface and calling AddHeaderHandler on builder provided by AddPlatformGrpcServices.

collection.AddPlatformGrpcServices(services => services
    .AddHeaderHandler<HeaderHandler>());

Clone this wiki locally