Fiddler is a wild popular tool for web development debugging. It enables user to look at the http traffic and diagnoses issues. Natively it provides Raw, Hex, Xml and some other views that understand specific formats. For the format it doesn’t understand, it provides an Inspector plugin model that user can easily implement and hook it up to display http package in a more readable format. In this post, I will show you a new inspector that understands .NET framing used by Polling Duplex WCF in Silverlight 4. It also understands raw binary Xml used by WCF RIA services and binary soap message used in general WCF services.
If you need some background on .Net framing protocol, you can start by reading Nicolas All’s blog posts on Message Framing. More information can be found in .Net framing specs if you want to know all the nitty-gritty details about the protocol. For the sake of simplicity, I will only talk about the framing protocols used in Silverlight 4 Polling Duplex.
One of the major change for Polling Duplex in Silverlight 4 is we enabled chunking. As shown by the Polling Duplex architecture diagram below, we supported duplex communication in Silverlight world using long poll HTTP request for messages from server to client. In Silverlight 2 we did some rudimentary performance optimization to let multiple sessions share the same poll to reduce number of current http requests. However the server side is still not very optimal in the sense that we only send back one message for each long poll request. This is because we used SOAP over http and there is no framing support to send back multiple messages.
To enable multiple callback messages sharing the same http poll request, we added a mode that uses .Net framing over http. In cases where the number of messages the server needs to send to the client is large, this mode provides dramatic improvements in communication performance compared to the old single message mode. More detail about performance comparison can be found from Tomek’s post here. The framing modes we chose are Single Sized mode for client to server message and Simplex mode for callback messages.
.Net framing is a binary format that breaks up a stream of data into demarcated messages. It has a series of typed records to indicate versions, modes, via, encoding, and soap envelops. Because of this, it is not the most human readable format. To help user understand their messages during development time, I implemented a WCF Silverlight fiddler inspector that takes a message stream and return formatted SOAP message(s) as shown below. To look at raw stream, you client Raw tab. To look decoded stream, click WCF Silverlight tab. Below are raw and encode Polling Duplex messages as seen in fiddler
The reason this inspector is called WCF Silverlight is because it not only understand .Net Framing used in Polling Duplex, it also understand raw binary Xml used by WCF RIA services and binary SOAP messages. It will try to decode based on the content-type of the http package. Below tables shows the currently supported content-types
Binary encoded SOAP message
Xml SOAP message
Binary Xml message
Deployment of the WCF Silverlight inspector is straightforward. Just copy the binary to %ProgramFiles%\Fiddler2\Inspectors. You should be able to find zipped Visual Studio 2010 solution file for the inspector and a compiled dll that you can readily use.
Hope this is helpful.
WCF RIA base team