Open CraigRice opened 6 years ago
I hit this too, and worked around this by registering the route myself and removing the constraint:
// instead of this
config.RegisterHealthCheckRoute(healthChecker);
// do this
config.Routes.MapHttpRoute(
name: "healthcheck",
routeTemplate: "healthcheck",
defaults: null,
constraints: null,
handler: new HealthCheckMessageHandler(healthChecker));
Hi,
I found an issue running the web api 2 health check when the site is hosted in a sub directory / application. The health check does not show. So this is the current fix for it:
Register like:
var healthChecker = ServiceLocator.Resolve<IHealthChecker>(); config.RegisterHealthCheckRoute(healthChecker);
Which calls this:
internal class ExactMatchConstraint : IHttpRouteConstraint { public bool Match(HttpRequestMessage request, IHttpRoute route, string parameterName, IDictionary<string, object> values, HttpRouteDirection routeDirection) { return string.CompareOrdinal(route.RouteTemplate.Trim('/'), request.RequestUri.AbsolutePath.Trim('/')) == 0; } }