0

Upgrading from version 3 of nservicebus to version 4, and receiving the following error message

"No message serializer has been configured."

stack trace:

at NServiceBus.Unicast.UnicastBus.ValidateConfiguration() in c:\TeamCity\buildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unicast\UnicastBus.cs:line 866 at NServiceBus.Unicast.UnicastBus.Start(Action startupAction) in c:\TeamCity\buildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unicast\UnicastBus.cs:line 739 at NServiceBus.Unicast.UnicastBus.Start() in c:\TeamCity\buildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unicast\UnicastBus.cs:line 718 at CycleMonkey.Inventory.CreateOrder.IT_OPS.CustomInit.Init() in d:\dev\backup\soa_cyclemonkey\Inventory\Inventory.CreateOrder\IT_OPS\CustomInit.cs:line 20 at NServiceBus.Hosting.Configuration.ConfigManager.ConfigureCustomInitAndStartup() in c:\TeamCity\buildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Hosting\Configuration\ConfigurationManager.cs:line 43 at NServiceBus.Hosting.GenericHost.PerformConfiguration() in c:\TeamCity\buildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Hosting\GenericHost.cs:line 126 at NServiceBus.Hosting.GenericHost.Start() in c:\TeamCity\buildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Hosting\GenericHost.cs:line 29 at NServiceBus.Hosting.Windows.WindowsHost.Start() in c:\TeamCity\buildAgent\work\d4de8921a0aabf04\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 56 at NServiceBus.Hosting.Windows.Program.<>c_DisplayClassd.b_5(WindowsHost service) in c:\TeamCity\buildAgent\work\d4de8921a0aabf04\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 76 at Topshelf.Internal.ControllerDelegates1.StartActionObject(Object obj) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 18 at Topshelf.Internal.IsolatedServiceControllerWrapper1.<>c_DisplayClass2.b_1(TService service) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65 at Topshelf.Internal.ServiceController1.<.cctor>b__1(ServiceController1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35 at Magnum.StateMachine.LambdaAction1.Execute(T instance, Event event, Object parameter) in :line 0 at Magnum.StateMachine.EventActionList1.Execute(T stateMachine, Event event, Object parameter) in :line 0

Has something been missed in the upgrade? Version 3 of code that was working :

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
}

public class CustomInit : IWantCustomInitialization
    {
                    public void Init()
        {
            Configure.Instance
                     .CastleWindsorBuilder()
                     .DefaultBuilder()
                     .Sagas()
                     .RunTimeoutManagerWithInMemoryPersistence()
                     .ConfigureMongoSagaPersister<CreateOrderSagaData>("mongodb://localhost/create-order");

            Configure.Instance
                     .XmlSerializer()
                     .MsmqSubscriptionStorage()
                     .MsmqTransport()
                     .UnicastBus();

        }
    }

Version 4 of the same code with the suggested changes required with the upgrade

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, UsingTransport<Msmq>
{
}

public class CustomInit : IWantCustomInitialization
    {
        public void Init()
        {
            Configure.Features.Enable<Sagas>();
            Configure.Serialization.Xml();

            Configure.Instance
               .CastleWindsorBuilder()
               .UseInMemoryTimeoutPersister()
               .ConfigureMongoSagaPersister<CreateOrderSagaData>("mongodb://localhost/create-order");

            Configure.Instance
                    .MsmqSubscriptionStorage()
                    .UnicastBus()
                    .CreateBus()
                    .Start();
        }

    }
2
  • 1
    Try getting rid of the calls to CreateBus and Start - those don't belong in IWantCustomInitialization.
    – Udi Dahan
    Aug 18, 2013 at 6:45
  • 2
    Also IConfigureThisEndpoint and IWantCustomInitialization should be the same class Aug 19, 2013 at 4:51

1 Answer 1

1

When bootstrapping a different container, use the IWantCustomInitialization interface together with the IConfigureThisEndpoint like @JohnSimons mentioned.

Also, when you are implementing the IWantCustomInitialization in the IConfigureThisEndpoint, there is no bus yet, so an instance has not been created at this point, so you'd need to use Configure.With() instead of Configure.Instance.

NOTE: You don't need to specify UsingTransport as Msmq is the default transport. You also don't need to specify Configure.Serialization.Xml() as Xml is the default serializer.

So, if you change your code to something like below, it should work:

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
{
    public void Init()
    {
        Configure.Features.Enable<Sagas>();

        Configure.With()
            .CastleWindsorBuilder()
            .UseInMemoryTimeoutPersister()
            .MsmqSubscriptionStorage();

    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.