Simple MSMQ Transport usage

Component: MSMQ Transport
NuGet Package: NServiceBus.Transport.Msmq (2-pre)
This page targets a pre-release version. Pre-releases are subject to change and samples are not guaranteed to be fully functional.


Ensure that MSMQ has been installed.

Code walk-through

This sample shows basic usage of MSMQ as a transport for NServiceBus. The application sends an empty message to itself, via the MSMQ transport, and writes to the console when the message is received.


var endpointConfiguration = new EndpointConfiguration("Samples.Msmq.Simple");
endpointConfiguration.UseTransport(new MsmqTransport());

Other settings such as DeadLetterQueue, Journal behavior, etc., can also be configured via the connection string.

Related Articles

  • MSMQ Transport
    MSMQ is a solid durable communications technology but does not dynamically detect network interfaces.

Last modified