有没有办法跟踪WCF中的所有异常?
如何在 WCF 中启用对任何异常的跟踪(不管它是否已处理或未处理)?这是我配置的代码:
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Error,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>
但后来我尝试在 SvcTraceViewer 中查看任何异常,但没有看到异常。如何获取跟踪日志中的异常? 提前致谢!
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="Error,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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在您的配置中没有看到明显的问题,但这就是我使用的,并且我确实在 Svc Trace Viewer 中看到异常:
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: