当前位置: 首页 > 工具软件 > Trace Viewer > 使用案例 >

WCF Note9(Configuring Tracing, Microsoft Service Trace Viewer)

盛琪
2023-12-01

Configuring Tracing http://msdn.microsoft.com/en-us/library/ms733025.aspx


<system.diagnostics>
   <sources>
       <source name="UserTraceSource" switchValue="Warning, ActivityTracing" >
          <listeners>
              <add name="xml"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData="C:\logs\UserTraces.svclog" />
          </listeners>
       </source>
   </sources>
   <trace autoflush="true" /> 
</system.diagnostics>


Complete Working Version

include

1. System.diagnostics

2.<system.serviceModel>
    <diagnostics>

      <messageLogging logMalformedMessages="true" logEntireMessage="true" logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="true" />
    </diagnostics>

<?xml version="1.0"?>
<configuration>
  <system.diagnostics>

    <sources>

      <source name="System.ServiceModel" switchValue="Error,ActivityTracing" propagateActivity="true">

        <listeners>

          <add type="System.Diagnostics.DefaultTraceListener" name="Default">

            <filter type="" />

          </add>

          <add name="ServiceModelTraceListener">

            <filter type="" />

          </add>

        </listeners>

      </source>

      <source name="System.ServiceModel.MessageLogging" switchValue="Error,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\Web_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp">

        <filter type="" />

      </add>

      <add initializeData="C:\log\Web_messages.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>
  <connectionStrings>
    <add name="AdventureWorksEntities" connectionString="metadata=res://*/ProductsModel.csdl|res://*/ProductsModel.ssdl|res://*/ProductsModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLExpress;Initial Catalog=AdventureWorks;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient"/>
    <add name="DurableServiceConnectionString" connectionString="Data Source=.\SQLExpress;Initial Catalog=WCFPersistence;Integrated Security=True"/>
  </connectionStrings>
  <system.serviceModel>
    <diagnostics>
      <messageLogging logMalformedMessages="true" logEntireMessage="true" logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="true" />
    </diagnostics>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DurableServiceBehavior">
          <persistenceProvider connectionStringName="DurableServiceConnectionString"
            type="System.ServiceModel.Persistence.SqlPersistenceProviderFactory" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="DurableServiceBehavior" name="ShoppingCartService.ShoppingCartServiceImpl">
        <endpoint address="http://localhost:9000/ShoppingCartService/ShoppingCartService.svc"
          binding="wsHttpContextBinding" bindingConfiguration="" contract="ShoppingCartService.IShoppingCartService" />
      </service>
    </services>
  </system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>


 类似资料:

相关阅读

相关文章

相关问答