aspnet / Diagnostics

[Archived] Diagnostics middleware for reporting info and handling exceptions and errors in ASP.NET Core, and diagnosing Entity Framework Core migrations errors. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
213 stars 111 forks source link

Cannot configure multiple paths over same custom port #514

Closed herrirya closed 5 years ago

herrirya commented 5 years ago

It appears it is not possible to have multiple paths that use the same custom port number (which is likely unintentional). For example:

app.UseHealthChecks("/health/live", port: 9999);
app.UseHealthChecks("/health/ready", port: 9999);

The second configured path in the example ("/health/ready") is not accessible because the first configured path is hogging up the port - seemingly due to the equality condition set up in HealthCheckApplicationBuilderExtensions.cs UseHealthChecksCore() method, line 214.

app.MapWhen(
  c => c.Connection.LocalPort == port,
  b0 => b0.Map(path, b1 => b1.UseMiddleware<HealthCheckMiddleware>(args)));

This middleware is great; thank you for your work.

rynowak commented 5 years ago

Thanks. This looks like this is indeed a bug.

rynowak commented 5 years ago

Fixed for the 2.2.0 release. Thanks for the feedback 👍