Search code examples
asp.net-coreazure-web-app-serviceblazor-server-side

Blazor HealthChecks - works on my system, error on Azure App Server


I have a Blazor Interactive Server app and have set up health checks as follows:

builder.Services.AddHealthChecks()
    .AddDbContextCheck<TrackingDbContext>("App Database")
    .AddDbContextCheck<UserDbContext>("Identity Database");

app.MapHealthChecks("health", new HealthCheckOptions
{
    ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
}).AllowAnonymous();

When I run on my system using the Visual Studio integrated app server, https://localhost:7229/health gives me JSON output with the status of each check.

When I run on this same app on Azure App Server using https://ohana.tradewindsstudios.us/health I get:

Error.
An error occurred while processing your request.
Request ID: 00-f4dd263c9fd8791cf7c9dda48954031a-09ba2674b6a1313b-00

Where do I find details on this error? And is there something I need to set in App Server to allow this to work?


Solution

  • Thank you to ajkuma who provided the way to find the answer here.

    To fetch more details, you may view the Application event Logs, checkout this doc for more details: application-event-log-azure-app-service

    That link provides the following steps:

    1. In the Azure portal, open the app in App Services.
    2. Select Diagnose and solve problems.
    3. Select the Diagnostic Tools heading.
    4. Under Support Tools, select the Application Events button.

    And in that log it was super fast/easy to find the problem. I had a typo in my Azure Storage connection string. This is the solution to my specific question. But I think the valuable part of this answer is, when this happens, read the event log.