+2  A: 

D'Oh! Post a question that you've been puzzeling over for a while and take a break. Then of course the answer hits you and it's totaly obvious! I was forgetting to configure the MsmqTransport, my working code is below for anyone that's interested.


Configure config = Configure.With();
config
    .CastleWindsorBuilder()
    .XmlSerializer()
    .MsmqSubscriptionStorage()
    .MsmqTransport()
        .IsTransactional(true)
        .PurgeOnStartup(false)
    .UnicastBus()
        .ImpersonateSender(false);

config
    .MsmqSubscriptionStorage()
    .Configurer
        .ConfigureComponent(NServiceBus.ObjectBuilder.ComponentCallModelEnum.None)
            .ConfigureProperty(x => x.InputQueue, "testapps_messagebus")
            .ConfigureProperty(x => x.NumberOfWorkerThreads, 1)
            .ConfigureProperty(x => x.ErrorQueue, "testapps_errors")
            .ConfigureProperty(x => x.MaxRetries, 5);

IBus bus = config
              .CreateBus()
              .Start();

bus.Publish(new Message(DateTime.Now));

Gareth
Can you elaborate on why you want to configure that using code?If you need to store config setting in another place than your app.config you should consider implementing a custom configuration source:http://sourceforge.net/apps/mediawiki/nservicebus/index.php?title=Overriding_Configuration
Andreas Öhlund
Thanks for the link. As you guessed I need to store the config in a section that is not an app.config. When I searched for a solution something very similar to this was what appeared.
Gareth