如何打开 WCF 跟踪? [英] How to turn on WCF tracing?

查看:26
本文介绍了如何打开 WCF 跟踪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:

我一直在尝试打开 WCF 跟踪,但仍然没有成功......下面这是我的最新更新.

我是否需要获得写入以下位置的权限?

 <trace autoflush="true"/><来源><源名称="System.ServiceModel"switchValue="信息,活动跟踪"传播活动=真"><听众><添加名称=sdt"type="System.Diagnostics.XmlWriterTraceListener"initializeData="@\\myservername\folder1\traces.svclog"/></听众></来源></来源></system.diagnostics>

我使用的是 .NET Framework 3.5.

打开 WCF 跟踪以进行调试的分步说明是什么?

解决方案

以下配置取自 MSDN 可用于在您的 WCF 服务上启用跟踪.

<预><代码><配置><系统诊断><来源><源名称="System.ServiceModel"switchValue="信息,活动跟踪"传播活动=真"><听众><add name="xml"/></听众></来源><源名称="System.ServiceModel.MessageLogging"><听众><add name="xml"/></听众></来源><源名称=myUserTraceSource"switchValue="信息,活动跟踪"><听众><add name="xml"/></听众></来源></来源><sharedListeners><添加名称=xml"type="System.Diagnostics.XmlWriterTraceListener"initializeData="Error.svclog"/></sharedListeners></system.diagnostics></配置>

要查看日志文件,可以使用C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\SvcTraceViewer.exe".

如果您的系统上没有SvcTraceViewer.exe",您可以从这里的Microsoft Windows SDK for Windows 7 and .NET Framework 4"包下载:

Windows SDK 下载

您不必安装整个东西,只需安装.NET 开发/工具"部分.

当/如果在安装过程中出现无意义的错误,Petopas 对 Windows 7 SDK 安装失败 的回答解决了我的问题.

Update:

I have been trying to turn on WCF tracing, but still no success... Below is my lastest update.

Do I need a permission to write to the below location?

  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="sdt"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "@\\myservername\folder1\traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

I am using .NET Framework 3.5.

What is the step-by-step instruction to turn on the WCF tracking for debugging purposes?

解决方案

The following configuration taken from MSDN can be applied to enable tracing on your WCF service.

<configuration>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true" >
        <listeners>
             <add name="xml"/>
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
            <add name="xml"/>
        </listeners>
      </source>
      <source name="myUserTraceSource"
              switchValue="Information, ActivityTracing">
        <listeners>
            <add name="xml"/>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
        <add name="xml"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData="Error.svclog" />
    </sharedListeners>
  </system.diagnostics>
</configuration>

To view the log file, you can use "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\SvcTraceViewer.exe".

If "SvcTraceViewer.exe" is not on your system, you can download it from the "Microsoft Windows SDK for Windows 7 and .NET Framework 4" package here:

Windows SDK Download

You don't have to install the entire thing, just the ".NET Development / Tools" part.

When/if it bombs out during installation with a non-sensical error, Petopas' answer to Windows 7 SDK Installation Failure solved my issue.

这篇关于如何打开 WCF 跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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