Closed h821463015 closed 4 years ago
We need the whole configuration. Are you configuring endpoints with appsettings?
startup.cs
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddUrlGroup(new Uri("http://www.baidu.com"), "baidu", HealthStatus.Unhealthy);
services.AddHealthChecksUI();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
//app.UseHttpsRedirection();
app.UseHealthChecks("/health", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
app.UseHealthChecksUI(setup => { setup.ApiPath = "/health"; setup.UIPath = "/healthchecks-ui"; });
app.UseMvc();
}
}
appsetting
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"HealthChecksUI": {
"HealthChecks": [
{
"Name": "health",
"Uri": "https://localhost:30080/health"
},
{
"Name": "a",
"Uri": "http://www.baidu.com"
}
],
"Webhooks": [],
"EvaluationTimeinSeconds": 10,
"MinimumSecondsBetweenFailureNotifications": 60
}
}
not support dontcore 2.2?
Package versions 2.2.* are for net core 2.2
yes,I'm used the Package versions 2.2 in dotnet core 2.2 ,but it doesn't work
You configuration is wrong. You are setting the UI Api backend to /health and the healthcheck segment to /health as well. I recommend you to check the samples section
hi,when I use HealthCheckUI,the page get error:Could not retrieve health checks data
the startup.cs code: ` public void ConfigureServices(IServiceCollection services) { services.AddHealthChecks()