Muokkaa

Jaa


<sendMessageChannelCache>

A service behavior that enables the customization of the cache sharing levels, the settings of the channel factory cache, and the settings of the channel cache for workflows that send messages to service endpoints using Send messaging activities.

<configuration>
  <system.ServiceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <sendMessageChannelCache>

Syntax

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

Attributes and Elements

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

Attributes

Attribute Description
allowUnsafeCaching A Boolean value that indicates whether to turn caching on. If your workflow service has custom bindings or custom behaviors, caching could be unsecure and therefore is disabled by default. However, if you want to turn caching on set this property to true.

Child Elements

Element Description
<channelSettings> Specifies the settings of the channel cache.
<factorySettings> Specifies the settings of the channel factory cache.

Parent Elements

Element Description
<behavior> of <serviceBehaviors> Specifies a behavior element.

Remarks

This service behavior is intended for workflows that send messages to service endpoints. These workflows are typically client workflows but could also be workflow services that are hosted in a WorkflowServiceHost.

By default, in a workflow hosted by a WorkflowServiceHost, the cache used by Send messaging activities is shared across all workflow instances in the WorkflowServiceHost (host-level caching). For a client workflow that is not hosted by a WorkflowServiceHost, the cache is available only to the workflow instance (instance-level caching). Caching is disabled by default for any send activity in your workflow that has endpoints defined in configuration.

For more information about how to change the default cache sharing levels and cache settings for the channel factory and channel cache, see Changing the Cache Sharing Levels for Send Activities.

Example

In a hosted workflow service, you can specify the factory cache and channel cache settings in the application configuration file. To do so, add a service behavior that contains the cache settings for the factory and channel cache and add this service behavior to your service. The following example shows the contents of a configuration file that contains the MyChannelCacheBehavior service behavior with the custom factory cache and channel cache settings. This service behavior is added to the service through the behaviorConfiguration attribute.

<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>  

See also