<channelSettings>

指定通道缓存的设置。

Schema Hierarchy

工作流的 <system.serviceModel>
  工作流的 <behaviors>
    工作流的 <serviceBehaviors>
      工作流的 <serviceBehaviors> 的 <behavior>
        <sendMessageChannelCache>
          <channelSettings>

语法

<behaviors>  <serviceBehaviors>    <behavior name=String">       <sendMessageChannelCache allowUnsafeCaching="Boolean" >                   <channelSettings idleTimeout="TimeSpan" leaseTimeout="TimeSpan" maxItemsInCache="Integer" />       </sendMessageChannelCache>    </behavior>  </serviceBehaviors></behaviors>

特性和元素

以下几节描述了特性、子元素和父元素。

特性

特性 说明

idleTimeout

一个 TimeSpan 值,指定对象在被释放之前可在缓存中保持空闲的最大时间间隔。

leaseTimeout

一个 TimeSpan 值,指定从缓存中移除对象需要等待的时间间隔。

maxItemsInCache

一个整数,指定可以位于缓存中的最大对象数。

子元素

无。

父元素

元素 说明

<sendMessageChannelCache>

一种服务行为,该行为支持缓存共享级别的自定义、通道工厂缓存的设置,以及使用 Send 消息传递活动将消息发送给服务终结点的工作流通道缓存的设置。

备注

此服务行为适用于将消息发送给服务终结点的工作流。这些工作流是典型的客户端工作流,但也可以是在 WorkflowServiceHost 中承载的工作流服务。

默认情况下,在 WorkflowServiceHost 承载的工作流中,由 Send 消息传递活动使用的缓存可在 WorkflowServiceHost 中的所有工作流实例中共享(宿主级缓存)。对于不是由 WorkflowServiceHost 承载的客户端工作流,该缓存仅对工作流实例可用(实例级缓存)。对于已在配置中定义了终结点的工作流中的所有 Send 活动,默认情况下为禁用缓存。

有关如何更改默认的缓存共享级别以及通道工厂和通道缓存的缓存设置的更多信息,请参见Changing the Cache Sharing Levels for Send Activities

示例

在承载的工作流服务中,可以在应用程序配置文件中指定工厂缓存和通道缓存设置。为此,应添加一个包含工厂和通道缓存的缓存设置的服务行为,并将此服务行为添加到您的服务中。下面的示例演示包含 **MyChannelCacheBehavior **服务行为(具有自定义工厂缓存和通道缓存设置)的配置文件的内容。此服务行为通过 **behaviorConfiguarion **特性添加到服务中。

<configuration>  
  <system.serviceModel>
    <!-- List of other config sections here --> 
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyChannelCacheBehavior">
          <sendMessageChannelCache allowUnsafeCaching ="false" >
            <!-- Control only the host level settings --> 
            <factorySettings maxItemsInCache = "8" idleTimeout = "00:05:00" leaseTimeout="10:00:00" />
            <channelSettings maxItemsInCache = "32" idleTimeout = "00:05:00" leaseTimeout="00:06:00" />
          </sendMessageChannelCache>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="MyService" behaviorConfiguration="MyChannelCacheBehavior" />
    </services>
  </system.serviceModel>
</configuration> 

另请参见

参考

SendMessageChannelCache
SendMessageChannelCacheElement
Send
ChannelCacheSettings

其他资源

Changing the Cache Sharing Levels for Send Activities

生成日期:2010-02-13