.net WCF消息过滤

.net WCF消息过滤,.net,wcf,logging,soap,diagnostics,.net,Wcf,Logging,Soap,Diagnostics,启用消息日志后,我可以看到所有消息,但需要过滤: <MessageLogTraceRecord> <Addressing> <Action>http://myuri/IManager/getData</Action> <To>http://localhost/MyService.svc</To> </Addressing> <s:Envelope xmlns:s="http://schem

启用消息日志后,我可以看到所有消息,但需要过滤:

<MessageLogTraceRecord>
<Addressing>
    <Action>http://myuri/IManager/getData</Action>
    <To>http://localhost/MyService.svc</To>
</Addressing>

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <getData xmlns="http://myuri/IManager">
              ............
        </getData>
    </s:Body>
</s:Envelope>
</MessageLogTraceRecord>
上面是我在通过http调用JavaWeb服务时在日志中看到的内容。注意,没有SOAP头,所以我不能像中那样按操作名称进行筛选。但是,禁止身体过滤。好的,我尝试了以下XPath表达式和许多其他表达式:

<filters>
    <add>/Addressing/Action[contains(text(), "http://myuri/IManager/getData")]</add>
    <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope">/soap:Envelope[not(soap:Header)]</add>
<filters>
但是所有的消息都被记录下来了,WCF认为这是错误的,并将其删除?。问题是:

为什么没有SOAP头?其他通过net.tcp传输的消息有吗? 如何编写XPath以仅过滤getData调用?
我相信你的过滤器不工作的原因是过滤被应用于SOAP消息。您正试图针对作为消息跟踪记录一部分的Addressing元素进行筛选。不幸的是,没有标题,我没有任何关于如何完成您要做的事情的建议。谢谢!我用我试过的一个过滤器更新了这篇文章——它不起作用。