This documentation is archived and is not being maintained.

MsmqTransportBindingElement Class

Represents the binding element used to specify the queuing communication properties for a Windows Communication Foundation (WCF) service that uses the native Message Queuing (MSMQ) protocol.

Namespace:  System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public sealed class MsmqTransportBindingElement : MsmqBindingElementBase

The MsmqTransportBindingElement enables the user to set the properties of the queued communication channel. The queued communication channel uses Message Queuing for its transport.

This binding element is the default binding element used by the Message Queuing standard binding (NetMsmqBinding).

string queueName = @".\private$\ServiceModelSamples";

if (!MessageQueue.Exists(queueName))
    MessageQueue.Create(queueName, true);

using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService)))
    BinaryMessageEncodingBindingElement encodingBindingElement = new BinaryMessageEncodingBindingElement();
    MsmqTransportBindingElement transportBindingElement = new MsmqTransportBindingElement();
    CustomBinding binding = new CustomBinding(encodingBindingElement, transportBindingElement);



    // The service can now be accessed.
    Console.WriteLine("The service is ready.");
    Console.WriteLine("Press <ENTER> to terminate service.");

    // Close the ServiceHost to shutdown the service.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0