0 Comments

It took me long enough to realize what was wrong in my Web.config so here’s a little friendly reminder: MessageEndpointMappings are case sensitive.

My Web.config had the following section:

<UnicastBusConfig>

  <MessageEndpointMappings>

    &lt;add Messages=<span style="color: #006080">&quot;Messages&quot;</span> Endpoint=<span style="color: #006080">&quot;InputQueue&quot;</span>/&gt;

  </MessageEndpointMappings>

</UnicastBusConfig>

And I had the following project:

messages

And Bus.Send gave the following error:

No destination specified for message messages.CreateUserCommand. Message cannot be sent. Check the UnicastBusConfig section in your config file and ensure that a MessageEndpointMapping exists for the message type.

After staring at the configuration for 15 minutes and rebuilding the solution 30 times without a success, I noticed the capital M. Changing it to lowercase cured my problem.

Just a small note. If the Messages is changed to point to an assembly which doesn’t exist (like noMessages), NServiceBus will throw the following exception when configuring the bus:

Exception: System.ArgumentException: Problem loading message assembly: noMessages ---> System.IO.FileNotFoundException: Could not load file or assembly 'noMessages' or one of its dependencies. The system cannot find the file specified.

Maybe the case sensitivity can be classified as a bug?