tags:

views:

22

answers:

1

Hi,

In my self host server, I config NServiceBus in this way:

            NServiceBus.Configure.With()
                .Log4Net()
                .CastleWindsorBuilder(_container)
                .XmlSerializer() // or BinarySerializer()
                .MsmqTransport()
                .IsTransactional(true)
                .UnicastBus()
                    .LoadMessageHandlers()
                .Sagas()
                .CreateBus()
                .Start();

It threw null reference exception at: src\impl\Sagas\NServiceBus.Sagas.Impl\SagaMessageHandler.cs:line 168

, which I figured it is because of missing saga persister.

In generic host, by passing "NServiceBus.Lite" from command line, the in-memory persister is used. How do I configure the self-host server to use in-memory saga persister?

Thanks!

+1  A: 

In 2.0 the InMemorySagapersister was part of the host. So if you're on 2.0 I suggest that you either copy and paste the persister to your own project or add a reference to the host.

The persister is configured by adding:

.InMemorySagaPersister() to your config call.

Andreas
Thanks! I had to use the following to make it work: Configure.Instance.Configurer.ConfigureComponent<InMemorySagaPersister>(ComponentCallModelEnum.Singleton);
Zhen.Lee