wcf开启诊断生成svclog
找到exe的配置文件
app.config为开发时模板
appname.exe.config为实际运行配置
在appname.exe.config中</configuration>上面增加以下节点
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="sdt"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "mywcf.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
wcf启动后会在exe所在目录生成mywcf.svclog直接用诊断工具或者双击打开 就能查看每次交互过程 太方便了

浙公网安备 33010602011771号