How to retrieve Transport connectionstring in customcheck


Is the transport connection string able to be retrieved from inside an nservicebus custom check? Does NServiceBus expose this somewhere that i can get it? I’m wanting to utilize the transport connection string ( in my case RabbitMQ ) to perform health checks using the connection-string to reach out to rabbitmq.

I Attempted to use the SettingsHolder class like so

var connectionString = SettingsHolder.Get<string>("NServiceBus.Transport.ConnectionString");

But nothing gets returned.


Hi @lochness,

out of the top of my head, the setting is NServiceBus.TransportConnectionString.



let me take my suggestion back. It won’t work as the type stored in that setting value is a public class with only internal properties. The only option you’d have to get the proper connection string out of it would be via reflection that is not really suggested.

Given that custom checks are registered into the DI container the easiest option for you is to create a class that holds the connection string information you need, register that in the container too, and make your custom check depend on it.


To add to what Mauro said, since you control the connection string and provide that during endpoint configuration, at that point you also can register a custom component as a singleton and inject it where’s needed.