This configuration section contains all the Windows Communication Foundation (WCF) ServiceModel configuration elements.
<system.serviceModel> <behaviors> </behaviors> <bindings> </bindings> <client> </client> <comContracts> </comContracts> <commonBehaviors> </commonBehaviors> <diagnostics> </diagnostics> <extensions> </extensions> <protocolMapping> </protocolMapping> <routing> </routing> <serviceHostingEnvironment> </serviceHostingEnvironment> <services> </services> <standardEndpoints> </standardEndpoints> <tracking> </tracking> </system.serviceModel>
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
|<behaviors>||This section defines two child collections named
|<bindings>||This section holds a collection of standard and custom bindings. Each entry is identified by its unique
|<client>||This section contains a list of endpoints a client uses to connect to a service.|
|<comContracts>||This section defines COM contracts enabled for WCF and COM interop.|
|<commonBehaviors>||This section can only be defined in the machine.config file. It defines two child collections named
|<diagnostics>||This section contains settings for the diagnostics features of WCF. The user can enable/disable tracing, performance counters, and the WMI provider, and can add custom message filters.|
|<extensions>||This section contains a collection of extensions, which enable the user to create user-defined bindings, behaviors, and other aspects of extensions.|
|<protocolMapping>||This section defines a set of default protocol mapping between transport protocol schemes (e.g., http, net.tcp, net.pipe, etc.) and WCF bindings.|
|<routing>||This section defines a set of routing filters, which determine the type of Windows Communication Foundation (WCF)MessageFilter to be used when evaluating incoming messages, as well as routing tables that define the target endpoints to send messages to when a filter matches.|
|<serviceHostingEnvironment>||This section defines what type the service hosting environment instantiates for a particular transport. If this section is empty, the default type is used.|
|<services>||The section contains a collection of services. For each service defined in the assembly, this element contains a
|<standardEndpoints>||This section defines a collection of standard endpoints, which are reusable preconfigured endpoints. A standard endpoint will have one or more of the address, binding and contract attributes set to a fixed value. For example, in the discovery endpoint the contract is fixed. You can also use standard endpoints to extend service endpoint with new properties similar to defining custom bindings.|
|<tracking>||This section defines tracking settings for a workflow service.|
|<configuration>||The root element for all configuration elements in a .NET configuration file.|
WCF does not add elements to the configuration sections of other products.
WCF services are defined in the
services section of the configuration file. An assembly can contain any number of services. Each service has its own
service configuration section. The section and its content define the service contract, behavior, and endpoints of the particular service.
Only a service's
name attribute is required. By default, a service's name describes the underlying CLR type used to implement a service; however, you may change the ConfigurationName property on a ServiceContractAttribute to override the CLR type requirement.
behaviorConfiguration attribute is optional. It identifies the service behavior used by a service. The behavior specified by this attribute must link to a service behavior defined in the scope of the same configuration file (i.e. the same file or a parent file).
Each service exposes one or more endpoints defined in an
endpoint element. Each endpoint has its own address and binding. All bindings used within the configuration file must be defined in the scope of the file.
Bindings are linked to endpoints through the combination of the attributes
binding attribute defines in which section the binding is defined. The
bindingConfiguration attribute defines which configured binding within the binding section is used. A binding section can define several configured bindings.
This is an example of a WCF configuration file.
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <behaviors> <!-- List of Behaviors --> </behaviors> <client> <!-- List of Endpoints --> </client> <diagnostics wmiProviderEnabled="false" performanceCountersEnabled="false" tracingEnabled="false"> </diagnostics> <serviceHostingEnvironment> <!-- List of entries --> </serviceHostingEnvironment> <comContracts> <!-- List of COM+ Contracts --> </comContracts> <services> <!-- List of Services --> </services> <bindings> <!-- List of Bindings --> </bindings> </system.serviceModel> </configuration>