WCF Operation types

By | May 11, 2015

In WCF we get the following types of operations. I will discuss each briefly.

  • Request-Reply.
  • One-way
  • Request-Reply with Duplex
  • One-way Duplex

Request-Reply operations

Operations-RequestResponse

This is the most commonly used type of operation.

  1. The client issues a request.
  2. The request travels as a message over the transport channel.
  3. The client waits for the service to process the request and waits for a response.
  4. The client is blocked until a response is received.
  5. If the service does not respond in time the client receives a time out exception.

As can be seen from the explanation above this operation will not scale well as it will be prone to time-outs when the service is places under load.

One-way operations

Operations-Oneway

One way operations are used when working with queues. The request is simply delivered freeing the client to continue.

  1. The client issues a request. The client is unaware that the operation it is invoking is one-way.
  2. The request travels as a message over the transport channel
  3. The client waits till the message is delivered to the service and then immediately returns.
  4. No value is returned. It is not possible to have a return value on this type operation.
  5. Depending on the binding used, No exception messages may be received by the client when a one-way operation are used.

If the service is too busy to respond to the request the request will go into a buffer and the client will continue. The buffer by default can store 1000 requests. (To increase this limit look at the Managed thread pool.) Once the buffer limit has been reached the request will not be delivered and a message saying that the service is unavailable will be returned.

Request-Reply with Duplex

Operations-Duplex

  1. The client issues a request.
  2. The request travels as a message over the transport channel.
  3. The client call contains the endpoint of a WCF service being hosted within the client. The client waits till the service responds and acknowledges that it has received the request.
  4. The client continues with its execution.
  5. The service processes the request and when done returns the result to the client by connecting to a service hosted within the client.

Note that the service can only respond back to the client while the client keeps the proxy open. If the client closes the proxy the server cannot respond back.Duplex calls are only supported by: WSDuelHttpBinding, NetTcpBinding & NetNamedPipeBinding.

One way with DuplexOperations-OnewayDuplex

  1. The client issues a request.
  2. The request travels as a message over the transport channel.
  3. The client call contains the endpoint of a WCF service being hosted within the client. The client returns immediately once the request has been delivered.
  4. The client continues with its execution.
  5. The service processes the request and when done returns the result to the client by connecting to a service within the client.

Note that the service can only respond back to the client while the client keeps the proxy open. If the client closes the proxy the server cannot respond back.Duplex calls are only supported by: WSDuelHttpBinding, NetTcpBinding & NetNamedPipeBinding.

Leave a Reply

Your email address will not be published.