Browsing Archives of Author »Ariela Boursi«

Choosing the right extensibility point

June 3, 2011


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 […]

IEndpointBehavior–How to add behavior on a specific endpoint?

April 30, 2011


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


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 […]

Asynchronous operations in WCF

March 7, 2011


WCF contracts can contain both synchronous and a-synchronous operations. A-synchronous operations must follow the following rules: They must follow the a-synchronous pattern: (see The Begin method takes the method parameters, a callback object, and a state object, and returns a System.IAsyncResult The matching End method takes a System.IAsyncResult and returns the return value of […]

Using RealProxy to extend the WCF proxy

January 31, 2011


In this post, I’m going to demonstrate how to use RealProxy in order to extend the generated client side WCF proxy. RealProxy is defined in the System.Runtime.Remoting.Proxies namespace and is not directly related to WCF, though it is used by WCF internally when generating a client proxy. The WCF client proxy is very extendable via […]

ICallContextInitializer–How to capture the thread’s state?

January 14, 2011


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.

EncoderFallbackException when passing UTF8 characters

January 11, 2011


Symptom A while ago, in one of our systems which sends text messages over WCF, we encountered a mysterious exception: System.Text.EncoderFallbackException: Unable to translate Unicode character \uD8B8 at index XX to specified code