In a pipeline component, some streams are not seekable: Improvements to the Archiver

A while back, I presented my Archiver Component . It archives messages as they enter a receive pipeline or right before they leave a send pipeline. It turns out that "DT" found a problem with this component (thank you for reporting this). I have updated the original entry and fixed the code.

The error in the code I originally provided was to use BodyPart.GetOriginalDataStream() even if I had the right comment above it!:

   // Get a *copy* of the original input stream
   originalStrm = bodyPart.GetOriginalDataStream();

I should have used BodyPart.Data which in the case of custom pipeline components makes a copy of the inbound message:

   // Get a *copy* of the original input stream
originalStrm = bodyPart.Data;

At this point, rewinding the stream into the finally block is not needed anymore. The updated source code can be found here .