当前位置:编程学习 > C#/ASP.NET >>

WCF问题,跪求解答?

WebServiceHost host = new WebServiceHost(obj, new Uri(url));
.....省略..........
没有通过配置文件来配置,使用代码来配置WCF,在程序里写完配置后,现在有个问题就是,如何使用代码配置WCF日志。
求代码... WCF代码实现配置WCF日志 --------------------编程问答-------------------- 在线等待...望高手教我... --------------------编程问答-------------------- 没人回 --------------------编程问答--------------------  WCF自定义Attribute记录日志或异常
http://blog.csdn.net/lianqizhi/article/details/8782354
怎样记录日志你可以自定义啊,你可以用log4net插件 --------------------编程问答-------------------- 日志的话 我还是推荐Log4。

自定义的Attribute 谁用谁知道。。。 --------------------编程问答--------------------
引用 3 楼 Chinajiyong 的回复:
WCF自定义Attribute记录日志或异常
http://blog.csdn.net/lianqizhi/article/details/8782354
怎样记录日志你可以自定义啊,你可以用log4net插件


你理解错了 --------------------编程问答--------------------
引用 4 楼 nevermore_0923 的回复:
日志的话 我还是推荐Log4。

自定义的Attribute 谁用谁知道。。。

你也理解错了
WCF本身带的有日志,我的意思是,怎样用代码来开启这个功能 --------------------编程问答--------------------
引用 4 楼 nevermore_0923 的回复:
日志的话 我还是推荐Log4。

自定义的Attribute 谁用谁知道。。。



自定义Attribute啊  。。。 --------------------编程问答--------------------
引用 7 楼 nevermore_0923 的回复:
Quote: 引用 4 楼 nevermore_0923 的回复:

日志的话 我还是推荐Log4。

自定义的Attribute 谁用谁知道。。。



自定义Attribute啊  。。。


WCF,在配置文件里面配置下
  <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>
      <source name='System.ServiceModel' switchValue='Warning, ActivityTracing'
        propagateActivity='true'>
        <listeners>
          <add type='System.Diagnostics.DefaultTraceListener' name='Default'>
            <filter type='' />
          </add>
          <add name='ServiceModelTraceListener'>
            <filter type='' />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData='C:\RunSite\NNF\EPS.Business.WCF.LOG\app_messages.svclog'
        type='System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
        name='ServiceModelMessageLoggingListener' traceOutputOptions='Timestamp'>
        <filter type='' />
      </add>
      <add initializeData='C:\RunSite\NNF\EPS.Business.WCF.LOG\app_tracelog.svclog'
        type='System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
        name='ServiceModelTraceListener' traceOutputOptions='Timestamp'>
        <filter type='' />
      </add>
    </sharedListeners>
    <trace autoflush='true' />
  </system.diagnostics>

会有WCF的日志,
我现在是通过硬编码的方式,来做的,没有配置文件,所现在不知道怎么通过编码实现配置文件这个功能。
补充:.NET技术 ,  Web Services
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,