Search code examples
azureasp.net-coreazureservicebushealth-check

Azure service bus healthcheck status always returning unhealthy


I am trying to implement a health check in one of my application which is .Netcore service by refering to Readme.md file.

Here is my code in startup.cs file

services.AddHealthChecks()
                .AddAzureServiceBusQueue(connectionString: Configuration["ServiceBusSettings:ConnectionString"],
                    queueName: Configuration["ServiceBusSettings:QueueName"], tags: new[] { "readiness" })
                .AddCheck("Ping", () => HealthCheckResult.Healthy(), tags: new[] { "liveness" })
                .AddUrlGroup(new Uri($"{Configuration["ReservationApi:Url"]}/healthcheck"), name: "ReservationApi Api Healthcheck", tags: new[] { "readiness" });

Both AddCheck, AddUrlGroup are showing healthy. The problem is I am able to push messages successfully to the queue but in the health check, it is showing unhealthy for ASB queue status.

Reference screenshot enter image description here

Please help me to resolve this issue where I am doing wrong or pls suggest me is there a better to know azure service bus health status

Thanks in advance


Solution

  • For others, if someone else is facing the issue. Then please verify the below actions

    • Verify whether you are using the Manage access keys for authenticating the service bus resource.
    • Test your code in a different network to verify if there an issue with the network/restriction.
    • You can use any of the debugging tools to capture the traffic to verify whether there are any requests initiate from your client machine and what was the response.