Application Insights 缺少 WCF 服务的数据库调用跟踪

问题描述 投票:0回答:1

我正在对某些 WCF 服务使用 Application Insights 跟踪,但似乎我看不到作为请求的一部分执行的数据库调用。

例如,单击事务,我看不到执行的数据库调用(作为 WCF 调用的一部分执行):

对于其他类似的 Web Api 应用程序,我可以正确地看到数据库调用。

WCF 服务是否需要一些特殊配置才能被 Application Insights 发现?

以下是 Application Insights 中包含的 web.config 包:

wcf azure-application-insights
1个回答
-1
投票

据我所知,您可以在wcf服务跟踪中使用消息日志记录。

WCF 使用 System.Diagnostics 命名空间中定义的跟踪机制。跟踪使用者为他们想要检索信息的跟踪源创建跟踪侦听器,如下所示:

<system.diagnostics>
<sources>
  <source name="System.ServiceModel" switchValue="All">
    <listeners>
      <add name="xmlTraceListener"/>
    </listeners>
  </source>
  <source name="System.ServiceModel.MessageLogging" switchValue="All">
    <listeners>
      <add name="xmlTraceListener"/>
      <add name="textBoxListener"/>
    </listeners>
  </source>
</sources>
<sharedListeners>
  <add name="xmlTraceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="ClientLogBasic.svclog"/>
  <add name="textBoxListener" type="WinTransmitterClient.MyTraceListener, WinTransmitterClient" initializeData=""/>
</sharedListeners>
<trace autoflush="true"/>

PS

<listeners>
标签的名称需要与
<sharedListeners>
的名称相同。在
<sharedListeners>
中,类型应包含完整的类名以及命名空间和程序集名称。

使用服务跟踪查看器工具查看生成的跟踪和消息日志。您可以参考跟踪和消息记录了解更多详细信息。

© www.soinside.com 2019 - 2024. All rights reserved.