tags:

views:

206

answers:

1

Hi,

I have a WCF Message (Channels.Message) which i'm trying to extract the body using .GetBody(). however, i notice that i can do it only once, and if i'm trying to use "GetBody<>" again, i'm getting :"This message cannot support the operation because it has been read."

Any idea how can i re-read the message body?

thanks

+3  A: 

Here is a pretty good article about what you are trying to do on MSDN. Please see the section titled Copying a Message into a Buffer. It explicitly talks about having to access the message body more than once.

http://msdn.microsoft.com/en-us/library/ms734675.aspx

Ben Runchey
that doesn't help much....I learned that you can read a message body only once, but i can't find MSFT logic here...
Or A
Specifically the article states..."Sometimes it is necessary to access the message body more than once, for example, to forward the same message to multiple destinations as part of a publisher-subscriber system. In this case, it is necessary to buffer the entire message (including the body) in memory. You can do this by calling CreateBufferedCopy."If you look then at the sample code in this section it shows accessing the body of a message more than once using CreateBufferedCopy
Ben Runchey