1

When using NServiceBus the Transport connection string doesn't seem to be fetched from the applicable Cloud configuration first but immediately from the app.config.

Options I've tried:

Using the configuration section (:

cscfg

<ConfigurationSettings>
  <Setting name="AzureServiceBusQueueConfig.ConnectionString" value="Endpoint=sb://xxx.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=yyy" />
</ConfigurationSettings>

app.config

<AzureServiceBusQueueConfig ConnectionString="Endpoint=sb://xxx.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=yyy" />

Using a custom connection string name:

cscfg

<ConfigurationSettings>
  <Setting name="NServiceBus.Transport" value="Endpoint=sb://xxx.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=yyy" />
</ConfigurationSettings>

app.config

<connectionStrings>
    <add name="NServiceBus.Transport" connectionString="Endpoint=sb://xxx.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=yyy"/>
</connectionStrings>

Also tried to override it by using the following line of code, since this issue is still open (https://github.com/Particular/NServiceBus.AzureServiceBus/issues/20):

configuration.UseTransport<AzureServiceBusTransport>().ConnectionString(CloudConfigurationManager.GetSetting("AzureServiceBusQueueConfig.ConnectionString"));

Or tried to set the connection string name manually, which works again using the app.config but doesn't let the cscfg override.

configuration.UseTransport<AzureServiceBusTransport>().ConnectionStringName("NServiceBus.Transport");
janpieter_z
  • 1,722
  • 13
  • 28

1 Answers1

2

Did you turn the azure configuration source on? You can do so using following extension method on the bus configuration:

.AzureConfigurationSource()

Yves Goeleven
  • 2,185
  • 15
  • 13
  • Sweet, thanks! For some reason the whole NServiceBus.Azure package wasn't included and obviously this also wasn't configured. – janpieter_z May 13 '15 at 10:50