打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
WCF 开启消息日志功能

生产环境

对于生产环境,如果您使用的是 WCF 跟踪源,请将 switchValue 设置为“警告”。如果您使用的是 WCFSystem.ServiceModel 跟踪源,请将 switchValue 属性设置为 Warning,并将propagateActivity 属性设置为 true。如果您使用的是用户定义的跟踪源,请将 switchValue 属性设置为Warning, ActivityTracing。该操作可以通过使用配置编辑器工具(SvcConfigEditor.exe)手动完成。如果您没有预测性能情况,则可以在上述所有情况中,将 switchValue属性设置为 Information,这将生成大量的跟踪数据。下面的示例演示这些推荐的设置。

调试环境

对于部署或调试环境,请为用户定义的或 System.ServiceModel 跟踪源选择InformationVerbose,以及ActivityTracing。若要增强调试功能,也应将其他跟踪源(System.ServiceModel.MessageLogging)添加到配置中以启用消息日志记录。请注意switchValue属性对此跟踪源没有任何影响。

下面的示例通过使用利用了 XmlWriterTraceListener的共享侦听器来演示推荐的设置。

 

配置文件:

<configuration>
 <!--开启日志功能-->
 <system.diagnostics>
   <trace />
    <sources>
      <sourcename="System.ServiceModel.MessageLogging">
        <listeners>
          <add name="xml"/>
        </listeners>
      </source>
    </sources>

   <sharedListeners>
     <add name="xml"
          type="System.Diagnostics.XmlWriterTraceListener" initializeData="D:\log\message1.svclog" traceOutputOptions="Timestamp"/>
   </sharedListeners>
   
 </system.diagnostics>
 <system.serviceModel>
   <!--开启日志功能-->
   <diagnostics>
     <messageLogging logEntireMessage="true" maxMessagesToLog="300"logMessagesAtServiceLevel="false" logMalformedMessages="false"logMessagesAtTransportLevel="true"/>
   </diagnostics>

 </system.serviceModel>
</configuration>

Reference:

http://technet.microsoft.com/zh-cn/library/aa702726(v=vs.100).aspx

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
WCF服务跟踪
WCF配置文件全攻略
抛弃WebService 在.NET4中用jQuery调用WCF
Could not load file or assembly ''System.Private.ServiceModel, Version=4.1.2.4, Culture=neut
WCF之旅(1):创建一个简单的WCF程序
我的WCF之旅(1):创建一个简单的WCF程序
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服