开发者

Is there any way to trace all exceptions in WCF?

How can I enable tracing of any exceptions (doesn't matter was it handled or unhandled) in WCF? Here is the code that I has configured:

<system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Err开发者_如何学Goor,ActivityTracing"
        propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener"
        name="ServiceModelTraceListener" traceOutputOptions="DateTime, Timestamp, Callstack">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>

But then I try to see any exceptions in SvcTraceViewer I don't see exceptions. How can I get exceptions in trace log? Thanks in advance!


I don't see an obvious problem in your config, but this is what I use, and I do see exceptions in Svc Trace Viewer:

    <system.diagnostics>
        <sources>
            <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
                <listeners>
                    <add name="XTL" />
                </listeners>
            </source>
        </sources>
        <sharedListeners>
            <add initializeData="trace.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="XTL" />
        </sharedListeners>
        <trace autoflush="true" />
    </system.diagnostics>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜