This documentation is archived and is not being maintained.

MsmqIntegrationBindingElement Class

This binding element can be used to enable Windows Communication Foundation (WCF) applications to send messages to and receive messages from existing MSMQ applications that use either COM, MSMQ native APIs, or the APIs in System.Messaging. Use this class to send and receive messages from MSMQ-based messaging applications.

Namespace: System.ServiceModel.MsmqIntegration
Assembly: System.ServiceModel (in system.servicemodel.dll)

public sealed class MsmqIntegrationBindingElement : MsmqBindingElementBase
public final class MsmqIntegrationBindingElement extends MsmqBindingElementBase
public final class MsmqIntegrationBindingElement extends MsmqBindingElementBase
Not applicable.

// Get MSMQ queue name from appsettings in configuration.
string queueName = @".\private$\Orders";

// Create the transacted MSMQ queue if necessary.
if (!MessageQueue.Exists(queueName))
    MessageQueue.Create(queueName, true);

// Create a ServiceHost for the CalculatorService type.
using (ServiceHost serviceHost = new ServiceHost(typeof(OrderProcessorService)))
    MsmqIntegrationBindingElement msmqBindingElement = new MsmqIntegrationBindingElement();

    String strScheme = msmqBindingElement.Scheme;
    Console.WriteLine("Scheme = " + strScheme);

    Type[] types = msmqBindingElement.TargetSerializationTypes;
    CustomBinding binding = new CustomBinding(msmqBindingElement);

    serviceHost.AddServiceEndpoint(typeof(IOrderProcessor), binding, @"msmq.formatname:DIRECT=OS:.\private$\Orders");


    // The service can now be accessed.
    Console.WriteLine("The service is ready.");
    Console.WriteLine("Press <ENTER> to terminate 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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0