NServiceBus XML Serializer错误

时间:2012-04-12 18:50:55

标签: nservicebus

我正在使用NSB 3.0.3。这是我的项目:

  • Registrations.Messages(所有事件都是命令消息在这里)
  • Registrations.Domain
  • Registrations.EventStorage
  • Registrations.MessageHandlers
  • Registrations.Server

Registrations.Server正在使用NServiceBus.Host来托管nsb。端点配置在这里:

public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher, IWantCustomInitialization
{
    #region Implementation of IWantCustomInitialization

    public void Init()
    {
        var kernel = new StandardKernel();
        kernel.Load(new BackendModule());

        Configure.With()
            .NinjectBuilder(kernel);
    }

    #endregion
}

服务器的配置是:

<?xml version="1.0" encoding="utf-8"?>

<configSections>
    <section name="MessageForwardingInCaseOfFaultConfig"
             type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
    <section name="UnicastBusConfig"
             type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/>
</configSections>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />

<UnicastBusConfig>
    <MessageEndpointMappings>
        <add Messages="Registrations.Messages"
             Endpoint="Accounts.Server"/>
    </MessageEndpointMappings>
</UnicastBusConfig>

我创建了一个测试控制台应用程序来发送命令。一切顺利,直到NSB发布消息。例外情况如下:

我创建了我的类来包装NSB:

public class NsbBus : IEventBus
{
    private readonly IBus m_nsb;

    public NsbBus(IBus nsb)
    {
        m_nsb = nsb;
    }

    #region Implementation of IEventBus

    public void Publish<T>(T @event) where T : class, IEvent<IIdentity>
    {
        m_nsb.Publish(@event);
    }

    public void PublishAll<T>(IEnumerable<T> events) where T : class, IEvent<IIdentity>
    {
        m_nsb.Publish(events);
    }

    #endregion
}

Type System.Collections.Generic.List`1[[Aec.Cqrs.IEvent`1[[Aec.Cqrs.IIdentity, Aec.Cqrs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Aec.Cqrs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] was not registered in the serializer. Check that it appears in the list of configured assemblies/types to scan.

该程序集Aec.Cqrs在服务器项目中引用并部署到bin目录。

我看过类似的帖子,但他们是关于网络项目的。这不是一个Web项目。有什么想法为什么序列化错误在这里?

由于

0 个答案:

没有答案