Home > Net >  How to add Azure SignalR to health checks
How to add Azure SignalR to health checks

Time:03-19

I try to add Azure SignalR healt check using nuget package AspNetCore.HealthChecks.SignalR. I use this code

 services.AddHealthChecks()
    .AddSignalRHub(
       Configuration.GetConnectionString("AzureSignalR"),
       name: "Azure SignalR");

but when I run app in healtcheck window I got info

Unhealthy
Invalid URI: The URI scheme is not valid.

My URI scheme: Endpoint=https://xxxx.service.signalr.net;AccessKey=******;Version=1.0;

How should be look like this URI?

CodePudding user response:

The documentation is non-existent but if you take a look at the tests they have written you can see that its expected to be an http endpoint of the Azure SignalR rather than a connection string:

https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/test/HealthChecks.SignalR.Tests/Functional/SignalRHealthCheckTests.cs

And under the hood its basically :

    Func<HubConnection> hubConnectionBuilder = () =>
        new HubConnectionBuilder()
            .WithUrl(url)
            .Build();

as you can see here https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/src/HealthChecks.SignalR/DependencyInjection/SignalRHealthCheckBuilderExtensions.cs

  • Related