Configuration Settings for the ASP.NET 4 Caching Session State Provider (AppFabric 1.1 Caching)
This topic covers the configuration settings for the AppFabric session state provider for ASP.NET. These settings are specified in the providers section of the sessionState element in the web.config file.
Session State Configuration Settings
Attribute | Description |
---|---|
name (required) |
The “friendly” name of the provider used by the sessionState element to reference the provider. |
type (required) |
The .NET Framework type string for the provider. This should be set to |
cacheName (required) |
The name of the AppFabric cache. |
dataCacheClientName (optional) |
The name of the dataCacheClient section to use from the dataCacheClients configuration section. This attribute is only required if multiple dataCacheClient sections are specified in the web.config file. By default, the provider will use the dataCacheClient section named |
applicationName (optional) |
A string value used by the provider when creating cache keys for storing session state data. When this attribute is not set, the session state is only shared across different physical instances of the same web application (with the additional requirement that each application instance is installed with the same IIS metabase path). For more information, see https://support.microsoft.com/kb/325056. When this attribute is set, the session state will be shared across all web applications that use the same applicationName value. |
useBlobMode (optional) |
A boolean value that specifies whether to load and store session state data as a single serialized blob. The default is |
nonInlinedAdditionalLifetime (optional) |
A timespan that the provider uses to track the next point in time that an individual (non-inlined) session state item needs to be touched to keep the item "alive". This value is only used when useBlobMode is set to |
retryInterval (optional) |
A timespan for the length of time to wait between retry attempts if an error occurs when communicating with the cache. The string format to use for this value is |
retryCount (optional) |
An integer value that tells the provider the number of retry attempts in the event of a communications failure with the cache. Note that not all operations are able to be retried. The default value is three retry attempts. The provider sleeps for the configured retryInterval time between each retry attempt. |
inlinedKeys (optional) |
A string value containing either a comma or semi-colon delimited set of session state keys whose values should be inlined in the session state metadata record. This setting only applies when useBlobMode is set to |
maxInlinedStringLength (optional) |
An integer value that indicates the maximum string size for a session state value that will be automatically inlined in the session state metadata record. This setting only applies when useBlobMode is set to |
Example
The following example sessionState element uses individual key-value pairs for session state as well as a shared application name.
<sessionState
mode="Custom"
customProvider="DistributedSessionProvider">
<providers>
<add name="DistributedSessionProvider"
type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider,
Microsoft.Web.DistributedCache"
cacheName="default"
applicationName="Contoso"
useBlobMode="true" />
</providers>
</sessionState>
See Also
Concepts
Session State Provider (AppFabric 1.1 Caching)
2012-09-12