Share via


WCF Binary Inspector, MS-NBFX, MS-NBFS

Fiddler is an indispensible tool for troubleshooting client/server communications, especially when your next best option is running the client under a debugger, or trying to glean info from IIS logs.

The WCF Binary Inspector for fiddler is a great help when you are working with WCF servies using the SOAP messages that have been binary encoded/compressed according to the MS-NBFS standard. 

As near as I can tell, MS-NBFS is essentially an implementation of MS-NBFX, which covers the actual binary encoding protocol, with a specified shared dictionary.  The NBFX protocol specifies "dictionary lookup" op-codes, both for elements and attributes, but says that both sides of a connection must agree on what the dictionary contents are.  MS-NBFS specifies that dictionary, with SOAP messages in mind, so high-probability strings like "mustUnderstand" are entries in the dictionary and messages get a good effective compression ratio.

The Binary inspector plugin uses the WCF message facility for doing its decoding, however, the message must be a valid SOAP message in WCF Binary format.  I was recently looking at a system where messages were in MS-NBFX, but without SOAP envelopes.  As such, the WCF Binary plugin was blowing up as it was setup to deal with SOAP messages.

It is possible to decode the MS-NBFX directly, by using XmlDictionaryReader.CreateBinaryReader. 

This post has sample code and some other good links.

I've sent over a copy of this code to the author of the fiddler WCF Binary inspector so that Fiddler's MS-NBFS decoder can handle more than just SOAP binary formatted messages.