This page refers to the legacy Azure Service Bus transport that uses the WindowsAzure.ServiceBus NuGet package. This package is currently on extended support until May 2022, after which it will be out of support according to the support policy. All users should migrate to the Azure Service Bus transport transport.

Common settings

In order to setup a basic endpoint using the Azure Service Bus transport the following configuration settings need to be provided:

var endpointConfiguration = new EndpointConfiguration("myendpoint");
var transport = endpointConfiguration.UseTransport<AzureServiceBusTransport>();
transport.ConnectionString("Paste connectionstring here");

var startableEndpoint = await Endpoint.Create(endpointConfiguration)
var endpointInstance = await startableEndpoint.Start()
  • UseTransport<AzureServiceBusTransport>(): Enables the Azure Service Bus transport.
  • UseForwardingTopology(): Defines the underlying layout of Azure Service Bus messaging entities.
  • ConnectionString(): Specifies the connection string of the Azure Service Bus namespace to be used by the transport.
  • UsePersistence<InMemoryPersistence>(): The Azure Service Bus transport has no dependency on persistence, so the in memory one will be sufficient. If there is a need to use sagas, one of the other persister implementations needs to be provided.

Full Configuration API

In Versions 7 and above, the Azure Service Bus transport has an extensive, code-only, configuration API. This API can be accessed from the UseTransport<AzureServiceBusTransport>() extension method. A full listing of the API can be found on the configuration API page

The configuration API provides fine grained access to the behavior of different layers in the transport.

  • Choosing topology controls how NServiceBus will lay out entities in the Azure Service Bus namespace.

In order to control the creation of these entities, the API provides direct access to the underlying configuration description objects through the following extension methods.

Connectivity settings are available at both the factory as well as receive/send client level.

There have historically been regular changes to the physical addressing logic, from naming conventions to assumptions and validations in both NServiceBus as well as Azure Service Bus itself. The following extension methods provide access to all of the aspects related to this addressing logic, so that the transport can be adapted to any future changes in this respect.


In versions 6 and below, configuration values are provided using the AzureServiceBusQueueConfig configuration section, refer to the AzureServiceBusQueueConfig configuration page for more details.

Related Articles

Last modified