首页 > 解决方案 > NServiceBus 没有反序列化消息

问题描述

我有一个使用 NServiceBus 的简单发送方/接收方设置

双方有:

Newtonsoft.Json (11.0.2)
Newtonsoft.Bson (1.0.1)
NServiceBus.Newtonsoft.Json (2.1.0)

当 NServiceBus 尝试反序列化消息时,我收到如下所示的错误

2018-10-01 14:39:47.383 ERROR NServiceBus.RecoverabilityExecutor Moving message 'a687555c-d4be-49dc-acba-a96c00e0d261' to the error queue 'error' because processing failed due to an exception:
NServiceBus.MessageDeserializationException: An error occurred while attempting to extract logical messages from incoming physical message a687555c-d4be-49dc-acba-a96c00e0d261 ---> System.Exception: Could not find metadata for 'Newtonsoft.Json.Linq.JObject'.
Ensure the following:
1. 'Newtonsoft.Json.Linq.JObject' is included in initial scanning. 
2. 'Newtonsoft.Json.Linq.JObject' implements either 'IMessage', 'IEvent' or 'ICommand' or alternatively, if you don't want to implement an interface, you can use 'Unobtrusive Mode'.
   at NServiceBus.Unicast.Messages.MessageMetadataRegistry.GetMessageMetadata(Type messageType)
   at NServiceBus.Pipeline.LogicalMessageFactory.Create(Type messageType, Object message)
   at NServiceBus.DeserializeLogicalMessagesConnector.Extract(IncomingMessage physicalMessage)
   at NServiceBus.DeserializeLogicalMessagesConnector.ExtractWithExceptionHandling(IncomingMessage message)

我不确定该怎么做才能解决这个问题,因为它是 Newtonsoft 内部的一个问题

有人遇到过这种情况么?

保罗

标签: json.netnservicebus

解决方案


推荐阅读