NServiceBus:NServiceBus抛出“ArgumentNullException”

时间:2010-12-13 23:42:23

标签: nservicebus

我正在尝试调用Bus.Publish来发布消息,但我不知道出了什么问题,因为NSB的异常只是存在一个空参数。

这是堆栈跟踪:

System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at NServiceBus.Serializers.XML.MessageSerializer.WriteObject(String name, Type type, Object value, StringBuilder builder)
   at NServiceBus.Serializers.XML.MessageSerializer.Serialize(IMessage[] messages, Stream stream)
   at NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage m, String destination)
   at NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations, String correlationId, MessageIntentEnum messageIntent, IMessage[] messages)
   at NServiceBus.Unicast.UnicastBus.Publish[T](T[] messages)

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:5)

找到答案。显然,在NServiceBus中使用未在命名空间中声明的消息类型是非法的。不要问我原因,但是包含我想要发布的类型的遗留代码没有在命名空间中声明类型,所以我必须创建一个新类型才能使它工作。

相关问题