WCF Trace
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MvcApplication2.serviceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MvcApplication2.serviceBehavior" name="MvcApplication2.service">
<endpoint address="" binding="wsHttpBinding" contract="MvcApplication2.Iservice">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MvcApplication2.serviceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MvcApplication2.serviceBehavior" name="MvcApplication2.service">
<endpoint address="" binding="wsHttpBinding" contract="MvcApplication2.Iservice">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "WCFTrace.svclog" />
</listeners>
</source>
</sources>
<trace autoflush="true" />
</system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "WCFTrace.svclog" />
</listeners>
</source>
</sources>
<trace autoflush="true" />
</system.diagnostics>
TraceViewer可以打开WCF Trace File。 WCF和早期的分布式技术相比,它的Logging及Tracing功能是我们所喜欢的,甚至可以监控这样的功能,在分布式系统中的错误信息是非常难以定位的,WCF有了这个功能,我们可以从容的应对错误信息。
在codeproject上有一个可管理WCF Trace File大小的XmlWriterTraceListener。
另外codeplex有一个非常不错的WCF测试工具 WCF Test Harness
http://blog.csdn.net/shanyou/archive/2008/11/17/4681282.aspx