共用方式為


<diagnostics>

The diagnostics element defines settings that can be used by an administrator for run-time inspection and control.

<system.serviceModel>

  <diagnostics>

                                    
                                    <system.serviceModel>
                                
                                    
                                       <diagnostics wmiProviderEnabled="Boolean"
                                
                                    
                                           performanceCounters="Off/ServiceOnly/All">
                                
                                    
                                           <messageLogging logEntireMessage="Boolean"
                                
                                    
                                              logMalformedMessages="Boolean"
                                
                                    
                                              logMessagesAtServiceLevel="Boolean"
                                
                                    
                                              logMessagesAtTransportLevel="Boolean"
                                
                                    
                                              maxMessagesToLog="Integer"
                                
                                    
                                              maxSizeOfMessageToLog="Integer" >
                                
                                    
                                              <filters>
                                
                                    
                                                  <clear />
                                
                                    
                                              </filters>
                                
                                    
                                           </messageLogging>
                                
                                    
                                       </diagnostics>
                                
                                    
                                    </system.serviceModel>
                                

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

wmiProviderEnabled

A Boolean value that specifies whether the WMI provider for the assembly is enabled. The WMI provider is required for user to gain run-time access to the inspection and control features of Windows Communication Foundation (WCF). The default is false.

performanceCounters

Specifies whether performance counters for the assembly are enabled. Valid values are

  • Off: Performance counters are disabled.

  • ServiceOnly: Only performance counters relevant to this service is enabled.

  • All: Performance counters can be viewed at runtime.

The default is Off.

Child Elements

Element Description

messageLogging

Describes the settings for WCF message logging.

Parent Elements


Element Description

serviceModel

The root element of all WCF configuration elements.

Remarks

The diagnostics section defines the diagnostics settings for all services located in an assembly. It is not possible to define separate diagnostics settings at the service level unless there is only one service in the assembly. Attributes are set according to the requirements of the section.

Example

<diagnostics wmiProviderEnabled="false"
       performanceCountersEnabled="true">
       <messageLogging logEntireMessage="true"
          logMalformedMessages="true"
          logMessagesAtServiceLevel="true"
          logMessagesAtTransportLevel="true"
          maxMessagesToLog="42"
          maxSizeOfMessageToLog="42">
         <filters>
         <clear />
    </filters>
       </messageLogging>
</diagnostics>

Footer image

Send comments about this topic to Microsoft.
© Microsoft Corporation. All rights reserved.