我正在尝试在客户端使用第三方WebService时在客户端中记录请求广告响应消息。
尽管尝试了很多日志文件 - 永远不会使用app.config文件中的以下WCF配置创建MessageLog.svclog。请帮忙。
<system.diagnostics>
<sources>
<source
name="System.ServiceModel.MessageLogging"
switchValue="Information, ActivityTracing" >
<listeners>
<add name="yourTrace"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\Log\MessageLog.svclog">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging
logMessagesAtTransportLevel="true"
logMessagesAtServiceLevel="false"
logMalformedMessages="true"
logEntireMessage="true"
maxSizeOfMessageToLog="65535000" maxMessagesToLog="500" />
</diagnostics>
</system.serviceModel>
谢谢!
答案 0 :(得分:4)
试试这个。注意SharedListeners节点
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging"
switchValue="Warning, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\Log\MessageLog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
...
</system.serviceModel>
答案 1 :(得分:0)
我遇到了WS客户端跟踪问题,其中App.config和文件夹权限完全没问题。在我的案例中的解决方案是我将其重命名为.exe.config(构建为WS客户端DLL的.dll.config)。所以请确保:
-m