I have set up the health checks in Program.cs for my Blazor server-side application. I'm running it on Azure App Service.
var healthCheckBuilder = builder.Services.AddHealthChecks()
.AddDbContextCheck<TrackingDbContext>("App Database")
.AddDbContextCheck<UserDbContext>("Identity Database");
if (!string.IsNullOrEmpty(sendGridKey))
healthCheckBuilder.AddSendGrid(sendGridKey, name: "SendGrid", failureStatus: HealthStatus.Degraded);
if (!string.IsNullOrEmpty(blobConnStr))
healthCheckBuilder.AddAzureBlobStorage(blobConnStr,
name: "Azure Blob Storage", failureStatus: HealthStatus.Degraded);
So what do I do now? I'd like to set it up so Azure will reboot the service and/or spin up a new instance and then kill this instance when needed.
I'd also like, if Azure has it, a page in the dashboard where I can see the history of the health of each service.
Thanks @zori for providing the MSDOC to configure Health Checks.
I have configured Health Checks through the Portal and also using Code with below steps.
I have created a Blazor application and configured Health Checks by adding the below code in
Program.cs:Program.cs:
Local Response for Health Check:
Deployed the application Azure App Service
Configuring Health Checks in Portal:
Monitoring=>Health checkin the Azure App Service and Enable Health Check and configure the path.Navigate to Instances to check the Server Instance Health Status: