0
votes

I followed the Getting Started With NServiceBus - Code First Article and when I attempt to send a message from the Client application (NServiceBusDemo.Client) I get the following exception:

2013-05-27 12:27:50,514 [7] ERROR NServiceBusDemo.Client.SendOrder [(null)] <(nu ll)> - Problem occurred when starting the endpoint. Common.Logging.ConfigurationException: The destination queue 'server@jasper' cou ld not be found. You may have misconfigured the destination for this kind of mes sage (NServiceBusDemo.Messages.Commands.PlaceOrder) in the MessageEndpointMappin gs of the UnicastBusConfig section in your configuration file. It may also be th e case that the given queue just hasn't been created yet, or has been deleted. - --> NServiceBus.Unicast.Queuing.QueueNotFoundException: Failed to send message t o address: [server@jasper] ---> System.Messaging.MessageQueueException: The queu e does not exist or you do not have sufficient permissions to perform the operat ion.

It's been a long time since I used NServiceBus but I do recall having to add the message endpoint mappings (not mentioned in the tutorial) which I have done:

  <UnicastBusConfig ForwardReceivedMessagesTo="audit">
    <MessageEndpointMappings>
      <add Messages="NServiceBusDemo.Messages" Endpoint="NServiceBusDemo.Server"/>
    </MessageEndpointMappings>
  </UnicastBusConfig>

When I look in the Message Queuing Console I have the following private queues created:

  • nservicebusdemo.client
  • nservicebusdemo.client.retries
  • nservicebusdemo.server
  • nservicebusdemo.server.retries
  • nservicebusdemo.server.timeouts
  • nservicebusdemo.server.timeoutsdispatcher
2
I'm curious, is "jasper" the name of your computer? - Udi Dahan

2 Answers

3
votes

The issue was that the the code from the article explicitly specified the endpoint name "Server" (which I had changed). As @UdiDahan pointed out on twitter, this takes precedence over the MessageEndpointMappings and is the reason why the mappings were not mentioned in the article.

I updated my client code to not specify the endpoint and therefore use the settings in app.config:

public class SendOrder : IWantToRunAtStartup
{
    public IBus Bus { get; set; }

    public void Run()
    {
        string product;
        while ((product = Console.ReadLine()) != "q")
        {
            Bus.Send(new PlaceOrder() { Product = product });
        }          
    }

    public void Stop()
    {

    }
}
1
votes

I had a similar problem (i.e. same error) but the solution to my problem was different from yours. I wanted to share here to make sure others don't have the same issue.

For me, the problem was happening because the console application wasn't starting. I had to set the startup project as the solution, which is configured to start both the web app and the console app. After doing this, everything started working.

I hope that helps someone.