title: How to configure nservicebus msmqtransport with code
body: <p>I'm just geting started with NServiceBus and can't figure out what I'm missing when configuring the MsmqTransport in code.  If I configure the publisher like this;</p>
  
  <pre><code>IBus bus = Configure.With()
                          .CastleWindsorBuilder()
                          .XmlSerializer()
                          .MsmqSubscriptionStorage()
                          .MsmqTransport()
                              .IsTransactional(true)
                              .PurgeOnStartup(false)
                          .UnicastBus()
                              .ImpersonateSender(false)
                          .CreateBus()
                          .Start();
  bus.Publish(new Message(DateTime.Now));
  </code></pre>
  
  <p>and the app.config like so</p>
  
  <p><pre><code>
  &lt;configSections>
      &lt;section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
  &lt;/configSections>
  &lt;MsmqTransportConfig 
      InputQueue="testapps_messagebus" 
      ErrorQueue="testapps_errors" 
      NumberOfWorkerThreads="1" 
      MaxRetries="5" />
  </pre></code></p>
  
  <p>Then all works fine - it will create the queues and I can happily message away, however if I delete the queues and then try again with code like so;</p>
  
  <pre><code>var config = Configure.With()
                .CastleWindsorBuilder()
                .XmlSerializer()
                .UnicastBus()
                    .ImpersonateSender(false)
                .MsmqSubscriptionStorage();
  config
      .Configurer
      .ConfigureComponent&lt;MsmqTransport&gt;(NServiceBus.ObjectBuilder.ComponentCallModelEnum.None)
          .ConfigureProperty(x =&gt; x.InputQueue, "testapps_messagebus")
          .ConfigureProperty(x =&gt; x.NumberOfWorkerThreads, 1)
          .ConfigureProperty(x =&gt; x.ErrorQueue, "testapps_errors")
          .ConfigureProperty(x =&gt; x.MaxRetries, 5);
  
  IBus bus = config
           .CreateBus()
           .Start();
  
  bus.Publish(new Message(DateTime.Now));
  </code></pre>
  
  <p>The messages seem to get lost as they do not appear in any queues nor get handled - I'm guessing I'm missing something but I can't see where.</p>