AspNetCore.Docs/aspnetcore/grpc/health-checks/Startup.cs

18 lines
446 B
C#

public void ConfigureServices(IServiceCollection services)
{
services.AddGrpc();
services
.AddGrpcHealthChecks()
.AddCheck("Sample", () => HealthCheckResult.Healthy());
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<GreeterService>();
endpoints.MapGrpcHealthChecksService();
});
}