SQL Server Transport Upgrade Version 3 to 4


The Transaction scope transaction mode is not available in .NET Core 2.0 because the implementation of SqlConnection does not support enlisting in an ambient transaction.

To run the upgraded project on .NET Core the transport needs to be switched to one of the native transactions modes. Consider using the Outbox to maintain the same exactly-once processing guarantees.

Transaction scope is supposed to be supported by SqlConnection in future versions of .NET Core.

Multi-instance mode

The multi-instance mode has been deprecated in Version 4. So the following is no longer supported:

var transport = endpointConfiguration.UseTransport<SqlServerTransport>();
transport.EnableLegacyMultiInstanceMode(async address =>
    var connectionString = address.StartsWith("RemoteEndpoint")
        ? "Data Source=SQL; Database=RemoteEndpoint; Integrated Security=True"
        : "Data Source=SQL; Database=ThisEndpoint; Integrated Security=True";
    var connection = new SqlConnection(connectionString);
    await connection.OpenAsync()
    return connection;

NServiceBus topologies with queues distributed between multiple catalogs and SQL Server instances can be migrated using a combination of Transport Bridge and multi-catalog addressing.


The multi-instance configuration above can be replaced with a multi-catalog addressing configuration, provided that all the databases are hosted on a single SQL Server instance:

var transport = endpointConfiguration.UseTransport<SqlServerTransport>();
transport.ConnectionString("Data Source=SQL; Database=ThisEndpoint; Integrated Security=True");
    endpointName: "RemoteEndpoint",
    catalog: "RemoteEndpoint");


When communicating with an endpoint that connects to a different SQL Server instance, send messages through a bridge. The multi-instance migration sample demonstrates this approach.

Both of these features are available for NServiceBus 6 (and SQL Server transport 3.1) so the topology migration can take place before switching to NServiceBus 7.

Related Articles

Last modified