AppFabric 会话状态提供程序 1.1 ( Microsoft.Web.DistributedCache.dll
) 需要 .net 4 并添加了许多新功能。您可以在此处查看如何对其进行配置,但无法将其用作 .net 2.0 网站的状态提供程序。
希望 AppFabric 会话状态提供程序 1.0 ( Microsoft.ApplicationServer.Caching.Client.dll
) 与 AppFabric 1.1 兼容。您只需要小心 web.config,因为配置部分不一样。
这是一个非常基本的 web.config :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!--configSections must be the FIRST element -->
<configSections>
<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient"
type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,
Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
<!-- cache client -->
<dataCacheClient>
<!-- cache host(s) -->
<hosts>
<host
name="YOURSERVERHERE"
cachePort="22233"/>
</hosts>
</dataCacheClient>
<system.web>
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
<providers>
<!-- specify the named cache for session data -->
<add
name="AppFabricCacheSessionStoreProvider"
type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider"
cacheName="NamedCache1"
sharedId="SharedApp"/>
</providers>
</sessionState>
</system.web>
</configuration>