NServiceBus:来自NServiceBus.Host的对象引用异常

时间:2010-11-12 23:04:08

标签: nservicebus

当我尝试启动PubSub示例的修改版本时,我收到异常。我正在尝试做一些事情,比如让订阅不自动,并注入我自己的ISubscriptionStorage实现。以下是我对MyPublisher \ EndpointConfig.cs所做的工作:

using NServiceBus;
using NServiceBus.Grid.MessageHandlers;
using NServiceBus.ObjectBuilder;
using NServiceBus.Sagas.Impl;

namespace MyPublisher
{
    class EndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization
    {
        public void Init()
        {
            NServiceBus.Configure.With()
                .DefaultBuilder()
                .XmlSerializer()
                .UnicastBus()
                .LoadMessageHandlers(First<GridInterceptingMessageHandler>.Then<SagaMessageHandler>())
                .DoNotAutoSubscribe();

            NServiceBus.Configure.Instance.Configurer.ConfigureComponent<StreamSubscriptionStorage>(ComponentCallModelEnum.Singleton);
        }
    }
}

过去是这样的:

using NServiceBus;
using NServiceBus.Grid.MessageHandlers;
using NServiceBus.Sagas.Impl;

namespace MyPublisher
{
    class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher, 
        ISpecifyMessageHandlerOrdering
    {
        public void SpecifyOrder(Order order) 
        {
            order.Specify(First<GridInterceptingMessageHandler>.Then<SagaMessageHandler>());
        }
    }
}

1 个答案:

答案 0 :(得分:1)

您忘记在自定义初始化中包含.MsmqTransport()。