I'm just getting refamiliarized with NServiceBus and I'm receiving a MessageDeserialization exception and stack trace as shown below.
For some environmental information... I'm using azure persistence with Queues. I can see the subscription table and what looks like all the endpoint addresses for my subscribers.
I have 3 MVC Web API hosted apps. The Service/API publishing the message that causes this exception is configured in its app.config to subscribe to itself and 2 other apis. The others that don't seem to have a problem have only 1 subscription. The first subscribes to one of its own events. And the other subscribes to 3 events from the 3rd service/api.
Things I've tried in order to resolve the issue. I was using conventions to define my events, but now my event messages all implement IEvent. I've also defined the JsonSerializer. Here's my bus configuration setup...
public class NServiceBusEndpointConfig : IConfigureThisEndpoint, AsA_Worker
{
public static IBus bus;
public void Customize(BusConfiguration busConfig)
{
var configuration = ContainerConfig.Container.Resolve<ICredentialDomainConfig>();
busConfig.AzureConfigurationSource();
busConfig.UseTransport<AzureStorageQueueTransport>()
.ConnectionString(configuration.NServiceBusQueueConnectionString);
busConfig.UsePersistence<AzureStoragePersistence>();
busConfig.EndpointName("service1");
busConfig.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(ContainerConfig.Container));
busConfig.UseSerialization<JsonSerializer>();
busConfig.License(configuration.NServiceBusLicenseString);
}
}
}
Here is the exception and stack trace details...
"NServiceBus.ExceptionInfo.ExceptionType": "NServiceBus.MessageDeserializationException", "NServiceBus.ExceptionInfo.InnerExceptionType": "System.Exception", "NServiceBus.ExceptionInfo.HelpLink": null, "NServiceBus.ExceptionInfo.Message": "An error occurred while attempting to extract logical messages from transport message
8dea1c2f-babb-438d-8e4c-a4cd002f5ab6", "NServiceBus.ExceptionInfo.Source": "NServiceBus.Core", "NServiceBus.ExceptionInfo.StackTrace": "NServiceBus.MessageDeserializationException: An error occurred while attempting to extract logical messages from transport message 8dea1c2f-babb-438d-8e4c-a4cd002f5ab6 ---> System.Exception: Could not find metadata for 'Newtonsoft.Json.Linq.JObject'.\r\nPlease ensure the following:\r\n1. 'Newtonsoft.Json.Linq.JObject' is included in initial scanning. \r\n2. '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'.\r\n at NServiceBus.Unicast.Messages.LogicalMessageFactory.Create(Type messageType, Object message, Dictionary
2 headers) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Unicast\\Messages\\LogicalMessageFactory.cs:line 59\r\n at System.Linq.Enumerable.WhereSelectArrayIterator
2.MoveNext()\r\n at System.Collections.Generic.List1..ctor(IEnumerable
1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)\r\n
1.InvokeNext(T context) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107\r\n at NServiceBus.BehaviorChain
at NServiceBus.DeserializeLogicalMessagesBehavior.Extract(TransportMessage physicalMessage) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Unicast\\Messages\\DeserializeLogicalMessagesBehavior.cs:line 93\r\n at NServiceBus.DeserializeLogicalMessagesBehavior.Invoke(IncomingContext context, Action next) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Unicast\\Messages\\DeserializeLogicalMessagesBehavior.cs:line 40\r\n --- End of inner exception stack trace ---\r\n at NServiceBus.DeserializeLogicalMessagesBehavior.Invoke(IncomingContext context, Action next) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Unicast\\Messages\\DeserializeLogicalMessagesBehavior.cs:line 47\r\n at NServiceBus.BehaviorChain1.<>c__DisplayClass5.<InvokeNext>b__2() in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 95\r\n at NServiceBus.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(IncomingContext context, Action next) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\MessageMutator\\ApplyIncomingTransportMessageMutatorsBehavior.cs:line 20\r\n at NServiceBus.BehaviorChain
1.InvokeNext(T context) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107\r\n at NServiceBus.BehaviorChain1.<>c__DisplayClass5.<InvokeNext>b__2() in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 95\r\n at NServiceBus.SubscriptionReceiverBehavior.Invoke(IncomingContext context, Action next) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Unicast\\Subscriptions\\MessageDrivenSubscriptions\\SubscriptionReceiverBehavior.cs:line 32\r\n at NServiceBus.BehaviorChain
1.InvokeNext(T context) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107\r\n at NServiceBus.BehaviorChain1.<>c__DisplayClass5.<InvokeNext>b__2() in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 95\r\n at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\UnitOfWork\\UnitOfWorkBehavior.cs:line 42\r\n at NServiceBus.BehaviorChain
1.InvokeNext(T context) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107\r\n at NServiceBus.BehaviorChain1.<>c__DisplayClass5.<InvokeNext>b__2() in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 95\r\n at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Unicast\\Behaviors\\ChildContainerBehavior.cs:line 17\r\n at NServiceBus.BehaviorChain
1.InvokeNext(T context) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107\r\n at NServiceBus.BehaviorChain1.<>c__DisplayClass5.<InvokeNext>b__2() in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 95\r\n at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Monitoring\\ProcessingStatisticsBehavior.cs:line 23\r\n at NServiceBus.BehaviorChain
1.InvokeNext(T context) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107\r\n at NServiceBus.BehaviorChain1.<>c__DisplayClass5.<InvokeNext>b__2() in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 95\r\n at NServiceBus.AuditBehavior.Invoke(IncomingContext context, Action next) in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Audit\\AuditBehavior.cs:line 20\r\n at NServiceBus.BehaviorChain
1.InvokeNext(T context) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\BehaviorChain.cs:line 107\r\n at NServiceBus.BehaviorChain1.Invoke() in c:\\BuildAgent\\work\\3206e2123f54fce4\\src\\NServiceBus.Core\\Pipeline\\BehaviorChain.cs:line 58\r\n at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain
1 pipelineAction, T context) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Pipeline\PipelineExecutor.cs:line 129\r\n at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message) in c:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 328","NServiceBus.FailedQ": "<<Queue, "NServiceBus.TimeOfFailure": "2015-07-06 02:52:26:254996 Z"
Here's the message class as requested... Originally there were 3 different "Infos" in the message, but tried to simplify, so now only the permission info in in the event...
public class CredentialPermissionGrantedEvent : IEvent
{
public PermissionInfo Permission { get; set; }
}
public class PermissionInfo
{
public Guid PermissionReference { get; set; }
public DateTime ActivationDate { get; set; }
public Guid CredentialReference { get; set; }
public Guid DeviceReference { get; set; }
public DateTime ExpirationDate { get; set; }
public string Function { get; set; }
public Guid ScheduleReference { get; set; }
public long Timestamp { get; set; }
}
Any assistance will be greatly appreciated
- Paul