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.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
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); serviceHost.AddServiceEndpoint( typeof(IQueueCalculator), binding, "net.msmq://localhost/private/ServiceModelSamples"); serviceHost.Open(); // The service can now be accessed. Console.WriteLine("The service is ready."); Console.WriteLine("Press <ENTER> to terminate service."); Console.WriteLine(); Console.ReadLine(); // Close the ServiceHost to shutdown the service. serviceHost.Close();
System.ServiceModel.Channels.BindingElement
System.ServiceModel.Channels.TransportBindingElement
System.ServiceModel.Channels.MsmqBindingElementBase
System.ServiceModel.Channels.MsmqTransportBindingElement
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.