Browsing All Posts filed under »WCF Extensions«

Choosing the right extensibility point

June 3, 2011 by


WCF pipeline architecture is very extendable, allowing the developer to hook-in, in various locations and implement a custom logic as needed. As there are so many extendability points and some might seem to overlap. It is sometimes confusing or overwhelming to decide which extensibility method to use and where exactly to hook it. So how […]

IDispatchMessageInspector –How to change the message on the server side?

May 4, 2011 by


IDispatchMessageInspector allows to validate and modify the Message on the server side (similar to IClientMessageInspector, which is added on the client). It’s interface allows you to interfere with the request Message before it arrives to the server, and with the response Message before it is sent to the client. The IDispatchMessageInspector interface contains the following […]

IEndpointBehavior–How to add behavior on a specific endpoint?

April 30, 2011 by


IEndpointBehavior, as its name implies, allows you to add your custom behaviors on the service endpoints both on the client, and on the server. The IEndpointBehavior interface is very similar to the IOperationBehavior interface which was described in the previous post

IClientMessageInspector – How to inspect and modify the message?

March 29, 2011 by


IClientMessageInspector allows to inspect or modify SOAP messages on the client side. Here are some examples of usage for this extensibility point: Message Validation – Ensure the message is compliant with a certain schema Validate its content or headers Logging or Tracing Manipulating the Message (For example: manipulate its headers) Note: Parameters validation is done […]

IDispatchMessageFormatter – How to customize reply Messages on the server side?

March 3, 2011 by


The IDispatchMessageFormatter extensibility hook is very similar to the client’s IClientMessageFormatter which was described in the previous post iclientmessageformatter. On the server side,  WCF converts requests into Message objects which are later on converted to a strongly typed operation parameters. The IDispatchMessageFormatter allows us to interfere in the later conversion (Message to operation parameters). It […]

IClientMessageFormatter– How to customize Messages on the client side

February 15, 2011 by


WCF allows client side developers to perform communication operations by using strongly typed operations. Internally, WCF translates these strongly typed operations into a generic Message class, which can be used by the WCF client runtime. When sending a message, WCF takes the parameters passed as the client operation parameters and “serializes” them into a Message […]

ICallContextInitializer–How to capture the thread’s state?

January 14, 2011 by


The ICallContextInitializer located in System.ServiceModel.Dispatcher namespace is used to initialize and restore the thread context (thread local storage, CallContext, etc.) before and after the operation is invoked on the server side. By default, WCF will not do it for you unless you explicitly add this behavior.

IOperationBehavior–How to customize behaviors for the WCF operation?

December 22, 2010 by


IOperationBehavior which is located in System.ServiceModel.Description assembly allows to extend the behaviors of operations for both the client and the server sides.

IParameterInspector – How to inspect arguments and return values?

December 21, 2010 by


Overriding the IParameterInspector located in System.ServiceModel.Dispatcher namespace allows inspecting parameters passed in each operation before the call is executed and after the response is returned. IParameterInspector’s interface contains the following methods: public interface IParameterInspector { void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState); object BeforeCall(string operationName, object[] inputs); } The ParameterInspector can be inserted […]

IOperationInvoker–How to wrap each call in the server side?

December 15, 2010 by


IOperationInvoker is responsible for invoking the methods on the server side with the required parameters and generate the required output parameters and the method’s return value. Its interface contains the following methods:   public interface IOperationInvoker { object[] AllocateInputs(); object Invoke(object instance, object[] inputs, out object[] outputs); System.IAsyncResult InvokeBegin(object instance, object[] inputs, System.AsyncCallback callback, object […]


Get every new post delivered to your Inbox.