我有一个调用 WCF 服务的客户端(单元测试)(在控制台应用程序中以调试模式托管)。
我在服务中有错误,但我不知道是哪个。我需要跟踪它,但不在客户端生成任何文件 svclog。
任何建议,任何示例代码都有效吗?
编辑:我使用记录 EntLibrary 4.1。我认为配置和 WCF 诊断中存在错误跟踪而不是跟踪日志。
我在客户端的配置是:
<system.diagnostics configSource="Config\diagnostics.config" />
<system.serviceModel>
<behaviors configSource="Config\system.servicemodel.behaviors.config" />
<bindings configSource="Config\system.servicemodel.bindings.config" />
<client configSource="Config\system.servicemodel.client.config" />
<diagnostics wmiProviderEnabled="false">
<messageLogging logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
/>
</diagnostics>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Warning" propagateActivity="true" >
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="myUserTraceSource" switchValue="Warning, ActivityTracing">
<listeners>
<add name="xml"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="TraceLog.svclog" />
</sharedListeners>
</system.diagnostics>
<loggingConfiguration configSource="Config\loggingConfiguration.config"/>
<exceptionHandling configSource="Config\exceptionHandling.config" />