https://github.com/nkz-soft/nkzsoft.service.configuration.grpc
https://github.com/nkz-soft/nkzsoft.service.configuration.grpc
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nkz-soft/nkzsoft.service.configuration.grpc
- Owner: nkz-soft
- License: mit
- Created: 2022-11-14T15:13:02.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-22T11:58:55.000Z (9 months ago)
- Last Synced: 2025-01-22T12:31:49.239Z (9 months ago)
- Language: C#
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NKZSoft.Service.Configuration.Grpc
[](https://www.nuget.org/packages/NKZSoft.Service.Configuration.Grpc/)
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:
```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGrpcServer();
var app = builder.Build();
app.MapGrpcEndpoints();
app.Run();
```
On the client side:
```csharp
var grpcChannel = GrpcChannel.ForAddress(client.BaseAddress!, new GrpcChannelOptions
{
HttpClient = client,
});
var callInvoker = grpcChannel.Intercept(new GrpcClientExceptionInterceptor());
callInvoker.CreateGrpcService();
```