【问题标题】:Unable to log WCF Message body无法记录 WCF 消息正文
【发布时间】:2014-12-19 15:54:30
【问题描述】:

我正在使用 32 位 BizTalk 2013r1 主机实例通过 LOB 适配器向 Oracle 发送插入请求。

我需要跟踪正在发送的消息正文。我已将 btsntsvc.exe.config 配置如下:

<configuration>
<system.diagnostics>
    <sources>
        <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
            <listeners>
                <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                    <filter type="" />
                </add>
                <add name="xml">
                    <filter type="" />
                </add>
            </listeners>
        </source>
        <source name="System.ServiceModel.MessageLogging" switchValue="Verbose, ActivityTracing">
            <listeners>
                <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                    <filter type="" />
                </add>
                <add name="xml">
                    <filter type="" />
                </add>
            </listeners>
        </source>
        <source name="System.Runtime.Serialization" switchValue="Verbose">
            <listeners>
                <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                    <filter type="" />
                </add>
                <add name="xml">
                    <filter type="" />
                </add>
            </listeners>
        </source>
    </sources>
    <sharedListeners>
        <add initializeData="C:\logs\WCFTrace2.svclog" type="System.Diagnostics.XmlWriterTraceListener"
name="xml" traceOutputOptions="LogicalOperationStack">
            <filter type="" />
        </add>
    </sharedListeners>
    <trace autoflush="true" />
</system.diagnostics>

<system.serviceModel>
    <client>
        <remove contract="IMetadataExchange" name="oracledb" />
        <endpoint binding="oracleDBBinding" contract="IMetadataExchange"
name="oracledb" />
    </client>
    <diagnostics>
        <messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
        <endToEndTracing activityTracing="true" messageFlowTracing="true" />
    </diagnostics>
</system.serviceModel>

我的问题是,虽然记录了消息的标题,但正文只是简单地记录为“...stream...”

<MessageLogTraceRecord>
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing"      xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action     s:mustUnderstand="1">http://Microsoft.LobServices.OracleDB/2007/03/BTS/Table/FOOTFALL/Insert</a:Action>
<a:MessageID>urn:uuid:5925f3c6-7670-4eaf-843f-df18a609a4fd</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
</s:Header>
<s:Body>... stream ...</s:Body>
</s:Envelope>
</MessageLogTraceRecord>

请告诉我我需要做什么才能获得消息正文的日志?

【问题讨论】:

  • 您为什么尝试使用WCF 消息记录而不是BizTalk 跟踪机制?您是否尝试在 WCF 端口上启用跟踪?
  • 当 BizTalk 适配器无法发送消息时,跟踪数据库中没有可用的内容。
  • 嗯,那似乎还有一个问题,与消息无关。 Windows 事件日志中是否有消息?
  • 问题;我正在发送一个被 Oracle 拒绝的请求。我已经克服了这一点。但我认为这个问题仍然有效,当 Oracle 适配器出现故障时,您在跟踪数据库中没有收到任何消息。帮助查找故障的唯一替代方法是使用 WCF 跟踪,但是虽然显示消息信封和标头,这很有帮助,但它不显示消息正文。
  • 您是如何发现出了什么问题的?

标签: wcf logging biztalk trace system.diagnostics


【解决方案1】:

创建另一个使用 FILE 适配器的发送端口非常简单。

  • 设置过滤器以捕获发送到 Oracle 的相同消息
  • 添加相同的地图

这将为每个请求写入一个文件到某个位置,并包含与发送到 Oracle 适配器相同的消息正文内容。

【讨论】:

  • 是的,我这样做了,但我想使用 WCF 跟踪,因为我需要检查响应 - 这似乎没有到达 msgbox。我猜消息正文的跟踪可能不起作用,因为适配器正在流式传输但对建议开放
  • 是什么让您认为响应似乎没有到达 msgbox?没有路由失败?要获取从发送端口返回的响应,您可以尝试以下操作:social.msdn.microsoft.com/Forums/en-US/…
  • 我已启用端口上的所有跟踪,但是当我查看“跟踪的消息事件我什么都看不到”时
猜你喜欢
  • 2011-01-08
  • 2010-12-01
  • 1970-01-01
  • 2011-04-10
  • 2011-01-12
  • 2010-10-28
  • 1970-01-01
  • 2012-03-08
  • 2011-12-24
相关资源
最近更新 更多