-
[C#] gRPC ExceptionC#/기초 2025. 1. 14. 14:50
Status(StatusCode="Unknown", Detail="Exception was thrown by handler.")
https://learn.microsoft.com/ko-kr/aspnet/core/grpc/error-handling?view=aspnetcore-9.0
.NET에서 gRPC를 사용한 오류 처리
.NET에서 gRPC를 사용하여 오류 처리를 수행하는 방법을 알아봅니다.
learn.microsoft.com
Status(StatusCode="ResourceExhausted", Detail="Received message exceeds the maximum configured message size.")
Server
public void ConfigureServices(IServiceCollection services) { services.AddGrpc(options => { options.EnableDetailedErrors = true; options.MaxReceiveMessageSize = 2 * 1024 * 1024; // 2 MB options.MaxSendMessageSize = 5 * 1024 * 1024; // 5 MB }); }
Client
static async Task Main(string[] args) { var channel = GrpcChannel.ForAddress("https://localhost:5001", new GrpcChannelOptions { MaxReceiveMessageSize = 5 * 1024 * 1024, // 5 MB MaxSendMessageSize = 2 * 1024 * 1024 // 2 MB }); var client = new Greeter.GreeterClient(channel); var reply = await client.SayHelloAsync( new HelloRequest { Name = "GreeterClient" }); Console.WriteLine("Greeting: " + reply.Message); }
https://learn.microsoft.com/en-us/aspnet/core/grpc/configuration?view=aspnetcore-9.0
gRPC for .NET configuration
Learn how to configure gRPC for .NET apps.
learn.microsoft.com
728x90'C# > 기초' 카테고리의 다른 글
[C#] object to List<> (0) 2025.02.12 [C#] C# dll COM (0) 2025.01.21 [C#] List 중복 제거 (0) 2024.12.18 [C#] !. 연산자 (0) 2024.12.04 [C#] 서비스 프로그램 제어 (0) 2024.12.02 댓글