如何在AddHealthCheckendPoint()方法中添加带有身份验证的URL
我有一个大型网站, www.example.com ,在IIS上托管了Windows Authentication On打开的IIS。该站点成功加载,并索要预期的身份验证详细信息。当我加载 www.example.com/healthchecks-ui 时,问题就到了。 由于UI页面使用 www.example.com/health 端点,它是身份验证墙后面的端点,页面加载具有不健康状态,如下所示:
当我关闭身份验证并允许在iis上允许匿名连接 www.example.com/healthchecks-ui 页面按预期加载:
这就是我在startup.cs文件中设置HealthCheck-ui设置的方式:
services.AddHealthChecksUI(opt =>
{
opt.UseApiEndpointHttpMessageHandler(sp =>
{
return new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual,
ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => { return true; }
};
});
opt.SetEvaluationTimeInSeconds(5); //time in seconds between check
opt.MaximumHistoryEntriesPerEndpoint(60); //maximum history of checks
opt.SetApiMaxActiveRequests(1); //api requests concurrency
opt.AddHealthCheckEndpoint("Site Health", "www.example.com/health"); //map health check api
}).AddInMemoryStorage();
}
是否
endpoints.MapHealthChecks("/health", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.
WriteHealthCheckUIResponse
});
endpoints.MapHealthChecksUI();
可以通过添加一些要使用的静态凭证来考虑身份验证?任何建议将不胜感激。
I have a blazor website, www.example.com, hosted on IIS with windows authentication turned on. The site loads successfully and asks for authentication details as expected. The problem comes when I load the www.example.com/healthchecks-ui page.
Since the UI page uses the www.example.com/health endpoint which is behind an authentication wall, the page loads with an unhealthy status as shown below:
When I turn off authentication and allow for anonymous connections on IIS the www.example.com/healthchecks-ui page loads as expected:
This is how i set the healthcheck-ui settings in the startup.cs file:
services.AddHealthChecksUI(opt =>
{
opt.UseApiEndpointHttpMessageHandler(sp =>
{
return new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual,
ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => { return true; }
};
});
opt.SetEvaluationTimeInSeconds(5); //time in seconds between check
opt.MaximumHistoryEntriesPerEndpoint(60); //maximum history of checks
opt.SetApiMaxActiveRequests(1); //api requests concurrency
opt.AddHealthCheckEndpoint("Site Health", "www.example.com/health"); //map health check api
}).AddInMemoryStorage();
}
and
endpoints.MapHealthChecks("/health", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.
WriteHealthCheckUIResponse
});
endpoints.MapHealthChecksUI();
Is there a way to account for authentication by adding some static credentials to be used? Any suggestions would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论