读取WCF消息正文两次-“无法读取消息" [英] Read WCF Message body twice - "Message Cannot be read"

查看:79
本文介绍了读取WCF消息正文两次-“无法读取消息"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF消息(Channels.Message),我正在尝试使用.GetBody()提取正文.但是,我注意到我只能执行一次,并且如果我再次尝试使用"GetBody<>",我将得到:此消息无法支持该操作,因为它已被读取."

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?

谢谢

推荐答案

这是一篇关于您要在MSDN上尝试做的很好的文章.请参阅标题为将消息复制到缓冲区中的部分.它明确地讨论了必须多次访问消息正文.

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

这篇关于读取WCF消息正文两次-“无法读取消息"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆