Debugging in BizTalk (and other async/messaging-based solutions) can be complex, and very often the UIs (the Admin Console and Hat) don’t give you enough tracking information, either because you’ve just re-deployed and lost tracking settings, or because the Sql Agent is turned off. This tends to happen frequently during development when you want to look at the body of the messages.

A very simple and very useful technique in this situation, and one I often find is not fully used, is to create a “Wire Tap”. A Wire Tap is an Integration Pattern that allows the inspection of messages that travel across a channel. In BizTalk, this translates to simply creating a (Static, One Way) Send Port that looks for specific messages (using its Filters), and sends them to some destination, typically, a file folder (SMTP email is another frequent choice). This port is not bound to any orchestration, it’s a content-based solution only.

One thing to remember about these Send Ports is that if you have a Send Port that has no filters, it catches nothing. Always remember to set up a filter. The ones I used the most are based on the message type (BTS.MessageType) and the receive port the message came in through (BTS.ReceivePortName).

I actually find that understanding and resorting to this mechanism is frequently a good indicator of the maturity of the BizTalk developer and his understanding of the pub/sub model in BizTalk Server.