behavior 元素包含服务行为的设置集合。 每个行为都按其 name 进行索引。 服务可使用 <endpoint> 元素的 behaviorConfiguration 特性通过此名称链接到每个行为。 这样,终结点可以共享公共行为配置而不用重新定义设置。
              
              
              
              configuration
  
              
              
              <system.ServiceModel>
    
              
              
              
              behaviors
      
              
              
              <serviceBehaviors>
        
              
              <behavior>
语法
<system.ServiceModel>  
  <behaviors>  
    <serviceBehaviors>  
      <behavior name="String">
        <bufferReceive maxPendingMessagesPerChannel="Integer" />
        <etwTracking profileName="String" />
        <sendMessageChannelCache allowUnsafeCaching="Boolean">
          <channelSettings idleTimeout="TimeSpan"
                           leaseTimeout="TimeSpan"
                           maxItemsInCache="Integer" />
          <factorySettings idleTimeout="TimeSpan"
                           leaseTimeout="TimeSpan"
                           maxItemsInCache="Integer" />
        </sendMessageChannelCache>
        <sqlWorkflowInstanceStore connectionStringName="String"
                                  hostLockRenewalPeriod="TimeSpan"
                                  instanceCompletionAction="DeleteNothing/DeleteAll"
                                  instanceEncodingAction="None/GZip"
                                  instanceLockedExceptionAction="NoRetry/BasicRetry/AggressiveRetry"
                                  runnableInstancesDetectionPeriod="TimeSpan" />
        <workflowIdle timeToPersist="TimeSpan"
                      timeToUnload="TimeSpan" />
        <workflowUnhandledException action="Abandon/AbandonAndSuspend/Cancel/Terminate" />
      </behavior>
    </serviceBehaviors>  
  </behaviors>  
</system.ServiceModel>  
特性和元素
下列各节描述了特性、子元素和父元素。
特性
| 属性 | 说明 | 
|---|---|
| name | 一个包含行为的配置名称的唯一字符串。 此值是用户定义的一个字符串,该字符串必须是唯一的,因为它将充当元素的标识字符串。 | 
子元素
| 元素 | 说明 | 
|---|---|
| <bufferReceive> | 一种服务行为,允许服务使用缓冲接收处理,以使工作流服务能够处理无序消息。 | 
| <routing> | 一种服务行为,允许服务使用 EtwTrackingParticipant 来利用 ETW 跟踪。 | 
| <sendMessageChannelCache> | 一种服务行为,该行为支持缓存共享级别的自定义、通道工厂缓存的设置,以及使用 Send 消息传递活动将消息发送给服务终结点的工作流通道缓存的设置。 | 
| <sqlWorkflowInstanceStore> | 一种服务行为,它允许您配置 SqlWorkflowInstanceStore 功能,该功能支持将工作流服务实例的状态信息保持到 SQL Server 2005 或 SQL Server 2008 数据库中。 | 
| <workflowIdle> | 一种服务行为,可以控制何时卸载和持久保存空闲工作流实例。 | 
| <workflowInstanceManagement> | 一种服务行为,可用于指定控制工作流实例如何运行的设置,包括持久性、未经处理的异常行为和空闲行为。 | 
| <workflowUnhandledException> | 一种服务行为,可用于指定工作流服务中发生未经处理的异常时所采取的操作。 | 
父元素
| 元素 | 说明 | 
|---|---|
| <serviceBehaviors> | 服务行为元素的集合。 |