In this tutorial, we are going to understand Message Exchange Pattern (MEP) in WCF.  In WCF Client and Server communicates and Exchange Messages using certain Pattern called as Message Exchange Pattern.

Introduction to Message Exchange Pattern:

In WCF Client and Server communicates and Exchange Messages using certain Pattern called as Message Exchange Pattern.

There are 3 types of Message Exchange Patterns (MEP)s.

Message Exchange Pattern

Request / Response:

In Request/Response, MEP client sends a request to the service and waits for the response until the service completed its processing. If the response is not generated within the ReceivedTimeout Period a Timeout exception will be thrown. To define Request/Response Message Exchange Pattern you can set IsOneWay to false. Since this is the default Message Exchange Pattern you don’t need to set IsOneWayto false for Request/Response Patter.

One Way Message Exchange Pattern:

In some cases when we don’t want any response message back from the service for example if I need to execute a long-running task One Way MEP is suitable for such scenarios.

In One Way MEP, the client just returns the header information with an HTTP Status code 202 without a message body. One Way Pattern doesn’t have support for output Parameter, Reference Parameter and no return value

If the service is busy with the other service and client sends the request then it can keep the request in the Queue and then the client can do his other work, the client is unblocked and we can set the Queue limit of the request.

To define One Way Message Exchange Pattern we just need to set IsOneWay to true.

Duplex Message Exchange Pattern:

In duplex pattern client and server both can send messages to each other. It means Duplex is a bi-directional commination channel. This pattern implements both Request/Response and One Way.

In order to use duplex contract, weneedto define a callback contract and assign the typeof that callback contract to the CallbackContract property of your service contract’s ServiceContract.

View More:

An Introduction to WCF.

What is WCF Contract?.

Conclusion:

Hope you understand MEP in WCF. Your Suggestions, Feedback and Comments are welcome.

Thank You,

 

Explore post tags

8 Comments

  • I’m really enjoying the theme/design of your website. Do you ever run into any browser compatibility problems? A small number of my blog audience have complained about my site not working correctly in Explorer but looks great in Safari. Do you have any recommendations to help fix this problem?

  • Thanks for sharing superb informations. Your site is very cool. I am impressed by the details that you have on this web site. It reveals how nicely you understand this subject. Bookmarked this web page, will come back for extra articles. You, my pal, ROCK! I found simply the information I already searched all over the place and just couldn’t come across. What a perfect web site.

  • Hands down, Apple’s app store wins by a mile. It’s a huge selection of all sorts of apps vs a rather sad selection of a handful for Zune. Microsoft has plans, especially in the realm of games, but I’m not sure I’d want to bet on the future if this aspect is important to you. The iPod is a much better choice in that case.

  • What i do not understood is in truth how you are not really much more smartly-preferred than you might be right now. You are so intelligent. You already know therefore considerably relating to this matter, made me personally imagine it from a lot of various angles.

  • Movimiento rectilíneo: Comprende el mecanizado de piezas Valencia realizado por cepillos, mortajadora, brochadora. Las nuevas herramientas y plaquitas MIFR 15 para ranurado frontal, para una profundidad de hasta 15 mm, incrementan significativamente las opciones de las herramientas de pequeño tamaño.