[C # .NET] [WCF] Practice unidirectional MSMQ @ self-host for MsmqIntegrationBinding

[C # .NET] [WCF] Practice unidirectional MSMQ @ self-host for MsmqIntegrationBinding


Another format is MsmqIntegrationBinding WCF MSMQ provided, it NetMsmq formats are very different, not substantially mix

Fee contract rule some time to find out, just like the rest of the usage on a http://www.dotblogs.com.tw/yc421206/archive/2013/10/23/125276.aspx the same, do not waste too much space here recorded only some of the highlights, people in need directly play with La Fan cases

Contract specifications

1. To use ServiceKnownType

2. To define IsOneWay / Action and void

3. The method parameters to be used MsmqMessage class

Here's an example:

[ServiceContract()]
[ServiceKnownType(typeof(User))]
public interface IProcessor
{
    [OperationContract(IsOneWay = true, Action = "*")]
    void SendUser(MsmqMessage
 
 
  
   request);
}
 
 

SerializationFormat

Because MsmqIntegrationBinding exchange data via the processing sequence of

SNAGHTML18e0290

Therefore, data classes to define the correct sequence of characteristics to Benpian is based Xml

[DataContract]
[Serializable]
public class User
{
    [DataMember]
    public Guid ID { get; set; }

    [DataMember]
    public string Name { get; set; }

    [DataMember]
    public int Age { get; set; }

    public override string ToString()
    {
        return string.Format("ID: {0}, Name: {1}, Age: {2}", this.ID, this.Name, this.Age);
    }
}

End position

To msmq.formatname: beginning with

msmq.formatname:DIRECT=OS:.private$myQueue


Article from: http: //www.dotblogs.com.tw/yc421206/archive/2013/10/24/125478.aspx

Rice Download: https: //az787680.vo.msecnd.net/user/yc421206/1310/201310241740255.zip

If any error, please notify the novice posting him to bear

2010 ~ 2017 C # in the fourth quarter

Original: Large column  [C # .NET] [WCF] practical way MSMQ @ self-host for MsmqIntegrationBinding


Guess you like

Origin www.cnblogs.com/chinatrump/p/11516340.html