Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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

// 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");

    serviceHost.Open();

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

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

Community Additions

Show:
© 2017 Microsoft