Reputation: 16002
I have configured NServiceBus to use Sql Server.
Configure.With()
.AutofacBuilder(container)
.UseTransport<SqlServer>("aureus")
.InMemorySubscriptionStorage()
.UnicastBus()
.DisableTimeoutManager()
.CreateBus()
.Start();
When I send a message in the controller.
this._bus.Send(new BillClient { Value = "testing." });
I get the error. Failed to send message to address: [queue] Invalid object name 'queue'.
My configuration is as follows:
<UnicastBusConfig>
<MessageEndpointMappings>
<add Assembly="Aureus.Messages" Namespace="Aureus.Messages" Endpoint="queue"/>
</MessageEndpointMappings>
</UnicastBusConfig>
What have I missed? I can't find out if I need to run scripts / or initialise the queues?
Upvotes: 1
Views: 1490
Reputation: 11
I'm no expert but I had to use the ConnectionString definition as the argument to .UseTransport() as shown below. In your post it's not clear what "aureus" will mean to NServiceBus software.
.UseTransport<SqlServer>(ConnectionString())
string ConnectionString()
{
return "NServiceBus/Transport\" connectionString=\"Data Source=.\\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True";
}
I was not able to use the ConnectionString name from my config file as an argument either. Here's the section of my config file fyi:
<connectionStrings>
<!-- Message Bus ********************************************** -->
<add name="NServiceBus/Transport" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True" />
<!-- Message Bus ********************************************** -->
</connectionStrings>
Also, for Endpoint in my config file, I had to use the namespace of my NServiceBus message handler class. Here's the endpoint section of my config file:
<UnicastBusConfig ForwardReceivedMessagesTo="audit">
<MessageEndpointMappings>
<!--Note - Endpoint must specify the Namespace of the server-->
<add Assembly="My.Messages.Assemblyname" Namespace="My.Messages.AssemblyNamespace" Endpoint="MyMessageHandlerAssy.Namespace" />
</MessageEndpointMappings>
</UnicastBusConfig>
Hope that helps you a bit.
Upvotes: 1
Reputation: 470
Instead of
.Start()
You need
.Start(() => Configure.Instance.ForInstallationOn<Windows>().Install());
To kick off the initialization of the queues.
Upvotes: 1