title: NServicebus subscriber throws an error when it receives an event
body: <p>i am crating a sample application with NServicebus. I have created 3 projects-</p>
  
  <ol>
  <li>Shared project --> It contains commands and events </li>
  <li>Publisher--> It publishes an event called "placeOrder" </li>
  <li>Subscriber --> It subscribe for the event "placeOrder" </li>
  </ol>
  
  <p>Here is my Command defined in shared project -</p>
  
  <pre><code>    public class OrderCommand : ICommand
      {
          public int Id { get; set; }
          public string Description { get; set; }
      }
  </code></pre>
  
  <p>Here is the event I have defined in shared project -</p>
  
  <pre><code>    public class OrderMessage : IEvent
      {
          public Guid Id { get; set; }
          public string Description { get; set; }
      }
  </code></pre>
  
  <p>Here is my publisher code -</p>
  
  <pre><code> public class Program
      {
          public static void Main(string[] args)
          {
              BusConfiguration busConfiguration = new BusConfiguration();
              busConfiguration.EndpointName("publisher");
              busConfiguration.AssembliesToScan(typeof(Shared.Messages.OrderMessage).Assembly, typeof(NServiceBus.MsmqTransport).Assembly);
  
              //busConfiguration.UseTransport&lt;RabbitMQTransport&gt;();
              busConfiguration.UseTransport&lt;MsmqTransport&gt;();
              busConfiguration.UseSerialization&lt;JsonSerializer&gt;();
              busConfiguration.UsePersistence&lt;InMemoryPersistence&gt;();
              busConfiguration.EnableInstallers();
  
              using (IBus bus = Bus.Create(busConfiguration).Start())
              {
                  SendOrder(bus);
              }
          }
  
          #region SendOrder
  
          static void SendOrder(IBus bus)
          {
              Console.WriteLine("Press enter to send a message");
              Console.WriteLine("Press any key to exit");
  
              while (true)
              {
                  ConsoleKeyInfo key = Console.ReadKey();
                  Console.WriteLine();
  
                  if (key.Key != ConsoleKey.Enter)
                  {
                      break;
                  }
  
                  OrderMessage placeOrder = new OrderMessage { Description = "TEST", Id = Guid.NewGuid() };
                  bus.Publish(placeOrder);
  
                  Console.WriteLine("Sent a new message with id: {0}", placeOrder.Id.ToString());
              }
          }
  
          #endregion
      }
  </code></pre>
  
  <p>Here is the App.Config of publisher-</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" /&gt;    
    &lt;/configSections&gt;
    &lt;MessageForwardingInCaseOfFaultConfig ErrorQueue="error" /&gt;
    &lt;connectionStrings&gt;
      &lt;add name="NServiceBus/Transport"
           connectionString="host=localhost"/&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Here is my code for subscriber -</p>
  
  <pre><code>public class Program
      {
          public static void Main(string[] args)
          {
              try
              {
                  BusConfiguration busConfiguration = new BusConfiguration();                
                  busConfiguration.AssembliesToScan(typeof(Shared.Messages.OrderMessage).Assembly, typeof(NServiceBus.MsmqTransport).Assembly);
  
                  //busConfiguration.UseTransport&lt;RabbitMQTransport&gt;();
                  busConfiguration.UseTransport&lt;MsmqTransport&gt;();
                  busConfiguration.UseSerialization&lt;JsonSerializer&gt;();
                  busConfiguration.UsePersistence&lt;InMemoryPersistence&gt;();
                  busConfiguration.EnableInstallers();
  
                  ////busConfiguration.LoadMessageHandlers&lt;First&lt;OrderMessage&gt;&gt;();
  
                  using (IBus bus = Bus.Create(busConfiguration).Start())
                  {
                      bus.Subscribe&lt;OrderMessage&gt;();
                      Console.WriteLine("Press any key to exit");
                      Console.ReadKey();
                  }
              }
              catch(Exception e)
              {
                  Console.Write(e.Message);
              }
          }
      }
  </code></pre>
  
  <p>Here is the handler for OrderMessage event-</p>
  
  <pre><code>  public class OrderCreatedHandler : IHandleMessages&lt;OrderMessage&gt;
      {
          void IHandleMessages&lt;OrderMessage&gt;.Handle(OrderMessage message)
          {
              Console.WriteLine(@"Handling: OrderPlaced for Order Id: {0}", message.Id);
          }
      }
  </code></pre>
  
  <p>This is my configuration for subscriber-</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" /&gt;
      &lt;section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/&gt;
    &lt;/configSections&gt;
    &lt;MessageForwardingInCaseOfFaultConfig ErrorQueue="error" /&gt;
    &lt;UnicastBusConfig&gt;
      &lt;MessageEndpointMappings&gt;
        &lt;add Assembly="Shared" Endpoint="publisher" /&gt;
      &lt;/MessageEndpointMappings&gt;
    &lt;/UnicastBusConfig&gt;
    &lt;connectionStrings&gt;
      &lt;add name="NServiceBus/Transport"
           connectionString="host=localhost"/&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>When I am running the code -</p>
  
  <p>the publisher send the message successfully. However no message is queued in messagequeue.
  Further, the subscriber, receives the message and then throw an exception as mentioned below</p>
  
  <p>Can anybody tell me what is wrong going on here?</p>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT-</p>
  
  <p>Full error stack</p>
  
  <pre><code>2015-12-18 15:27:30.614 INFO  NServiceBus.Unicast.Transport.TransportReceiver Failed to process message
  System.InvalidOperationException: No handlers could be found for message type: Shared.Events.OrderMessage
     at NServiceBus.LoadHandlersBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Behaviors\LoadHandlersBehavior.cs:line 29
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.ApplyIncomingMessageMutatorsBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\MessageMutator\ApplyIncomingMessageMutatorsBehavior.cs:line 23
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.ExecuteLogicalMessagesBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Messages\ExecuteLogicalMessagesBehavior.cs:line 24
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.CallbackInvocationBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Behaviors\CallbackInvocationBehavior.cs:line 22
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.DeserializeLogicalMessagesBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Messages\DeserializeLogicalMessagesBehavior.cs:line 47
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\MessageMutator\ApplyIncomingTransportMessageMutatorsBehavior.cs:line 20
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.SubscriptionReceiverBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Subscriptions\MessageDrivenSubscriptions\SubscriptionReceiverBehavior.cs:line 31
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\UnitOfWork\UnitOfWorkBehavior.cs:line 42
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Behaviors\ChildContainerBehavior.cs:line 17
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.&lt;&gt;c__DisplayClass4_0.&lt;InvokeNext&gt;b__0() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 94
     at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Monitoring\ProcessingStatisticsBehavior.cs:line 23
     at NServiceBus.BehaviorChain`1.InvokeNext(T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107
     at NServiceBus.BehaviorChain`1.Invoke() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 52
     at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\PipelineExecutor.cs:line 129
     at NServiceBus.Pipeline.PipelineExecutor.InvokePipeline[TContext](IEnumerable`1 behaviors, TContext context) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\PipelineExecutor.cs:line 85
     at NServiceBus.Pipeline.PipelineExecutor.InvokeReceivePhysicalMessagePipeline() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\PipelineExecutor.cs:line 102
     at NServiceBus.Unicast.UnicastBus.TransportMessageReceived(Object sender, TransportMessageReceivedEventArgs e) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\UnicastBus.cs:line 826
     at NServiceBus.Unicast.Transport.TransportReceiver.OnTransportMessageReceived(TransportMessage msg) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 411
     at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 344
     at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 228
     at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.Action() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Transports\Msmq\MsmqDequeueStrategy.cs:line 266
  The thread 0x3584 has exited with code 0 (0x0).
  2015-12-18 15:27:30.645 ERROR NServiceBus.Faults.Forwarder.FaultManager SLR has failed to resolve the issue with message e13fa75c-2bc6-4ac6-978f-a57200fe77e1 and will be forwarded to the error queue at error@PC
  The thread 0x17a8 has exited with code 0 (0x0).
  The program '[13440] dnx.exe: Program Trace' has exited with code 0 (0x0).
  The program '[7692] dnx.exe: Program Trace' has exited with code 0 (0x0).
  The program '[13440] dnx.exe' has exited with code -1 (0xffffffff).
  The program '[7692] dnx.exe' has exited with code -1 (0xffffffff).
  </code></pre>