Condividi tramite


Checklist for using MsmqIntegrationBinding

The MsmqIntegrationBinding allows users to create WCF applications that send and receive messages to and from existing MSMQ applications that use System.Messaging or other MSMQ APIs.

  1. The operation contract should be one-way i.e. IsOneWay = true.
  2. Action property should be specified in the operation contract to indicate a service operation handles all messages that the service receives but cannot be directed to a service operation i.e. Action="*".
  3. The service operation should take a single argument MsmqMessage<T>, where T is a serializable type. You can use the [Serializable] attribute in front of the class definition or use a WCF data contract.
  4. Type T should be specified using the ServiceKnownType attribute on the service contract e.g. [ServiceKnownType(typeof(PurchaseOrder))].

[ServiceContract(Namespace = "https://Microsoft.ServiceModel.Samples")]
[ServiceKnownType(typeof(PurchaseOrder))]
public interface IOrderProcessor
{
    [OperationContract(IsOneWay = true, Action = "*")]
    void SubmitPurchaseOrder(MsmqMessage<PurchaseOrder> msg);
}