แก้ไข

แชร์ผ่าน


<behavior> of <serviceBehaviors>

The behavior element contains a collection of settings for the behavior of a service. Each behavior is indexed by its name. Services can link to each behavior through this name using the behaviorConfiguration attribute of the <endpoint> element. This allows endpoints to share common behavior configurations without redefining the settings. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see Simplified Configuration and Simplified Configuration for WCF Services.

Note

Behavior elements specific to Windows Workflow activities, such as the <sendMessageChannelCache> element, are documented in the <behavior> of <serviceBehaviors> page.

<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>

Syntax

<system.ServiceModel>
  <behaviors>
    <serviceBehaviors>
       <behavior name="String" />
    </serviceBehaviors>
  </behaviors>
</system.ServiceModel>

Attributes and Elements

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

Attributes

Attribute Description
name A unique string that contains the configuration name of the behavior. This value is a user-defined string that must be unique, since it acts as the identification string for the element. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see Simplified Configuration and Simplified Configuration for WCF Services.

Child Elements

Element Description
<dataContractSerializer> Contains configuration data for the DataContractSerializer.
<persistenceProvider> Specifies the type of the persistence provider implementation to use, as well as the time-out to use for persistence operations.
<routing> Provides run-time access to the routing service to allow dynamic modification of the routing configuration.
<serviceAuthenticationManager> Provides a workflow configuration element that establishes at the service level the validity of a transmission, message, or originator..
<serviceAuthorization> Specifies settings that authorize access to service operations.
<serviceCredentials> Specifies the credential to be used in authenticating the service and the client credential validation-related settings.
<serviceDebug> Specifies debugging and help information features for a Windows Communication Foundation (WCF) service.
<serviceDiscovery> Specifies the discoverability of service endpoints.
<serviceMetadata> Specifies the publication of service metadata and associated information.
<serviceSecurityAudit> Specifies settings that enable auditing of security events during service operations.
<serviceThrottling> Specifies the throttling mechanism of a WCF service.
<serviceTimeouts> Specifies the timeout for a service.
<workflowRuntime> Specifies settings for an instance of WorkflowRuntime for hosting workflow-based WCF services.
<useRequestHeadersForMetadataAddress> Enables the retrieval of metadata address information from the request message headers.

Parent Elements

Element Description
<serviceBehaviors> A collection of service behavior elements.