Session State Provider (AppFabric 1.1 Caching)
The Microsoft AppFabric 1.1 for Windows Server session state provider is an out-of-process storage mechanism for ASP.NET applications. This provider enables you to store your session state in an AppFabric cache rather than in-memory or in a SQL Server database.
The AppFabric session state provider has the following improvements over past ASP.NET session state providers:
It internally uses the NetDataContractSerializer class for session state serialization.
It can store session state as a single blog or as individual item.
It can share session state among different ASP.NET applications.
It supports concurrent access to same set of session state for multiple readers and a single writer.
It can use compression.
The use of NetDataContractSerializer class for serialization results in the support of a wider range of serializable types. This includes support for binary serializable types.
The session state provider can store and retrieve session state as a single blob, which is the technique that providers have used in the past. However, it also has the ability to store session state as individual key-value pairs. In this mode, the items are retrieved from the cache when requested. This can provide a performance enhancement when working with a combination of smaller and larger objects in session state. Pages that require only the smaller objects will not have to retrieve and de-serialize the larger items.
The feature to store individual key-value pairs in session state is only supported on-premises with Microsoft AppFabric 1.1 for Windows Server. In the Cloud, Windows Azure Caching has a similar session state provider but does not currently support this feature.
The provider supports the ability for different ASP.NET applications to read and write the same session state data. For example say a developer has two different ASP.NET sites: /contoso and /adventureworks. The session state provider can be configured in each web application to point at the same session state store in the cache cluster. As a result, both applications will read and write the same session data for any given session identifier.
The session state provider supports concurrent access to same set of session state for multiple readers and a single writer. Readers in this case are defined as pages that are marked as using ReadOnly session state. Applications that make extensive use of AJAX callbacks will not experience server-side request queuing if most of the application’s session state access patterns only require read-only access to session state.
Compression is a feature of Microsoft AppFabric 1.1 for Windows Server Caching. In the configuration file, you can enable caching in the dataCacheClient element with the isCompressionEnabled attribute. The following example shows a dataCacheClient named
default that has compression enabled.
<dataCacheClient name="default" isCompressionEnabled="true"> <hosts> <host name="CacheServer1" cachePort="22233" /> <host name="CacheServer2" cachePort="22233" /> </hosts> </dataCacheClient>
All cache clients must be updated to use the latest Microsoft AppFabric 1.1 for Windows Server SDK if compression is enabled.
In This Section