-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not retrieve health checks data #48
Comments
Your configuration is wrong! Can you check the samples? The project UiAndApi contains the same you are trying to do. |
With UseHealthChecks you can configure the health checks to be executed and also where the response is /healthchecks. With UseHealthChecksUI you configure where the UI work, you don’t need setup api path or UI path, only create the app settings configuration. Navigate to /HealthChecks-UI Follow the samples, this can clarify the scenario |
Please, follow the samples or share with me the project to help you. |
Any update on this issue, can you check my latest references? |
Had to run out for some Xmas shopping :). Still not good. I've stripped out the DbContext check and copied the configuration directly from the sample. The JSON endpoint looks like this::
But the UI still shows unhealthy.
|
Can you share your app settings or if os posible your project or simple repro? |
Here is the appsettings. I can't share the project but will try and test out a repro tomorrow {
"ConnectionStrings": {
"DefaultConnection": "SQL Server"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Trace",
"Microsoft": "Information",
"Microsoft.EntityFrameworkCore.Database.Command": "Information"
}
},
"ApplicationInsights": {
"InstrumentationKey": ""
},
"HealthChecks-UI": {
"HealthChecks": [
{
"Name": "Http and UI on single project",
"Uri": "http://localhost:44393/healthz"
}
],
"Webhooks": [],
"EvaluationTimeOnSeconds": 10,
"MinimumSecondsBetweenFailureNotifications": 60
//"HealthCheckDatabaseConnectionString": "Data Source=[PUT-MY-PATH-HERE]\\healthchecksdb" //-> Optional, default on WebContentRoot
}
} |
Also you don’t have any entry on healthchecks! You can try the sample and uiandapi and check if work for you? |
I think is good can you add a healthcheck after UseHealthChecks and check again? |
Sorry what do you mean
I'm copying the code directly from the sample project. |
The sample also include a HealthCheck for uri (AspNetCore.HealthChecks.Uris package)
|
Added that line and the package. The JSON shows the entry as healthy but the UI page still shows unhealthy. Is it an issue de-serializing the JSON? I will have to try and create a new project tomorrow and see if I can reproduce. Thanks for your help in looking into this.
|
Send me the project and I try to help, your scenario is the same as uiandapi sample. |
Any update on this issue, can you create and send me a sample project to check? |
I was able to get the sample working but still having problems with my app. When I look at the trace I see a request is being made to https://localhost:44393/healthchecks-api although I've copied in your configuration of using "healthz" as the endpoint. When I navigate to "healthz" I see the JSON showing the app as healthy. When I navigate to "healthchecks-api" I see an empty array.
|
You are confusing some terms. Well, I try to explain, I suppose you have HealthChecks and UI in the same project like UIAndApi sample. When you add HealthChecks and the customized response with: app.UseHealthChecks("/healthz", new HealthCheckOptions() { Your are configuring a customized response for your health checks. When you navigate into /healthz you view some json that represent the current status of configured health checks, ok? Well, next step is adding a UI for show this result more "human readable". AddHelthchecks and AddHealthChecksUI add services and middlewares for this. By default, if you don't change anything you have different new middlewares responding on /healthchecks-ui => This is where the UI is showed /healthchecks-api => UI is and SPA app, this is where the javascript call to get data. In addition to middlewares the UI create a HostedService that use the appsettings configuration to call automatically to all healthz configured endpoints, in your case the appsettings need to contain the url information of your project, the uri for your /healthz If the sample works for you, you have some items misconfigured, I try to help but need to view your code or a repro |
So right after I posted that last comment I changed the samples to use Kestrel and not IIExpress and they worked without changing the ports. Just did the same with my app and and the Health Checks UI worked!! Except now my login code is failing for some reason. So the issue is with using IIExpress. Is the idea that the Health checks UI will be hosted in a separate app service than the app that is being monitored? |
In your launchsettings.json (inside Properties folder in vs) you have different ports for IIS Express and Command Line Kestrel, you need to set the rignt port for each configuration on your appsettings.json. |
Also, if your healchecksdb is created with invalid configuration, please delete it before launch again the project. |
Thanks for all of your help. FYI you can repo the issue I was seeing in the sample app.
Status is reported as unhealthy: Change the web server to the project name (aka Kestrel) and it runs fine. |
Please, read my comments, on this sample the appsettings.json is configure to use the Kestrel configured port, not the iis configured port. If you use IIS please set valid port on appsettings.json. AppSettings for IIS "Uri": "http://localhost:6001/healthz" AppSettings for Kestrel "Uri": "http://localhost:5000/healthz" |
Hi @bradleypatton I close this issue because I think all is ok and no more feedback is on the comments. If you have more information please re-open. |
Following the steps in the Scott Hanselman post and the ASP.NET 2.2 video, I've added the following to ConfigureServices
In Configure added the following:
And in appsettings
When I navigate to /healthcheck I get the following JSON
But when I navigate to /healthcheckui I get the following message "Could not retrieve health checks data"
I can see it's reading the appsettings as the Webhook name changes.
What am I doing wrong?
The text was updated successfully, but these errors were encountered: