Component: NServiceBus
NuGet Package NServiceBus (4.x)
Standard support for version 4.x of NServiceBus has expired. For more information see our Support Policy.

NServiceBus takes instances of .NET objects (messages, events and commands) and then sends/receives them over a specified Transport. As part of this the object needs to be serialized and deserialized. To achieve this NServiceBus uses Serializers.

When transitioning to a new serializer then messages that are currently 'in flight' are formatted using the previous serialization format. This includes Saga Timeout and Deferred/Delayed messages via timeout persistence.
Make sure all queues of all endpoints are drained and empty, including any failed messages in the error queue or messages that need to be retried in the ServiceControl queue. NServiceBus Versions 5 and earlier only support a single serializer/deserializer. Live migration is only supported in NServiceBus Versions 6 and above.

The Newtonsoft JSON Serializer provides an effective general-purpose serializer appropriate for most use cases based on the ubiquitous Json.NET package. The Newtonsoft package provides a good combination of compactness, human readability, and performance. Other serializers are supported in order to enable specific performance or integration requirements.

Supported Serializers

Using an existing serializer

The default serializer used in NServiceBus projects is the custom XmlSerializer.

The pages dedicated to particular Serializers show how to configure the endpoint to use each of them. Unless explicitly configured otherwise, NServiceBus will use XmlSerializer for serializing and deserializing all messages.

The same Serializer must be used by the sending endpoint to serialize messages and by receiving endpoint to deserialize them, unless additional deserializers are specified.

In order to register a community maintained serializer or custom serializer, refer to the Custom serializers - Register the serializer section.


Related Articles

Last modified