简体   繁体   English

将请求消息复制到WCF服务上的IParameterInspector.BeforeCall()

[英]Copy the RequestMessage at IParameterInspector.BeforeCall() on WCF Service

I have WCF service with IParameterInspector class which suppose to store the message for each incoming message. 我有带有IParameterInspector类的WCF服务,该服务IParameterInspector为每个传入消息存储消息。 I need to extract values from the inputs parameters. 我需要从输入参数中提取值。

In order to get the message I'm trying to access 为了获取消息,我正在尝试访问

Blockquote OperationContext.Current.RequestContext.RequestMessage Blockquote 块引用OperationContext.Current.RequestContext.RequestMessage块引用

and than call to CreateBufferedCopy() method to create a copy so I can work (read) the message and send it forward, but than I'm getting the following error: 然后调用CreateBufferedCopy()方法创建一个副本,这样我就可以处理(读取)消息并将其转发,但是却出现以下错误:
"This message cannot support the operation because it has been read." “此消息无法支持该操作,因为已读取该消息。”

Any ideas? 有任何想法吗? Many thanks! 非常感谢!

IParameterInspector is fired after the message has been read by the data contract/xml serializer so the message body has been already consumed. 数据协定/ xml序列化程序已读取消息后,将触发IParameterInspector因此消息主体已被使用。

If you want to get the raw input message, you should be doing so in an IDispatchMessageInspector instead and make a buffered copy of the message so that you can still pass it on further down the WCF pipeline. 如果要获取原始输入消息,则应改为在IDispatchMessageInspector进行此操作,并对该消息进行缓冲复制 ,以便仍可以将其沿WCF管道进一步传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用IParameterInspector.BeforeCall(string operationName,object []输入)终止调用 - Using IParameterInspector.BeforeCall(string operationName, object[] inputs) to abort a call 如果IParameterInspector BeforeCall方法失败,如何限制wcf中的Operation方法调用 - How to restrict the Operation method call in wcf if it fails in IParameterInspector BeforeCall method IParameterInspector .BeforeCall 中的引用类型字段为空 - Reference type fields are null in IParameterInspector .BeforeCall IParameterInspector的BeforeCall方法有效,但不会中止调用 - IParameterInspector's BeforeCall method works but does not abort a call 来自IParameterInspector的Autofac WCF? - Autofac WCF from IParameterInspector? 从IParameterInspector(WCF)访问上下文信息 - access context-informationes from IParameterInspector (WCF) 在异常情况下,如何正确使用 IParameterInspector 和 WCF 服务来记录 Web 请求? - How to use IParameterInspector with WCF services correctly to log web requests also in an exception case? 这是WCF服务吗? - Is this a WCF Service? WCF服务与WCF服务通信 - WCF Service to talk to WCF Service 在新的AppDomain中启动WCF服务以启用卷影副本(托管Windows服务) - Start WCF service in a new AppDomain to enable shadow copy (Windows Service hosted)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM