配置ASP.NET网站使用AppFabric Caching存储Session数据
来源:互联网 发布:2017美工电脑配置要求 编辑:程序博客网 时间:2024/04/27 19:44
网上很多这类配置资料都是CTP版本的,正式版本中已经不能这样用了。
首先确保需要放到Session中的对象是支持二进制序列化的对象,
修改web.config文件如下:
<configSections>
<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>
<!-- 分布式缓存配置项 -->
<dataCacheClient>
<hosts>
<host name="sr-af-01" cachePort="22233" />
</hosts>
<!-- 不使用任何安全策略,
默认情况下安装好AppFabric后,
还需要配置有权限访问缓存的帐号,
此处配置为允许任何帐号连接缓存服务器,
注意需要AppFabric服务器也配置为不需要授权(修改ClusterConfig.xml)。 -->
<securityProperties mode="None" protectionLevel="None" />
</dataCacheClient>
<sessionState mode="Custom" cookieName=".XXXXSessionId" customProvider="AppFabricCacheSessionStoreProvider">
<providers>
<!-- 为自定义会话状态指定命名缓存 -->
<add name="AppFabricCacheSessionStoreProvider"
type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider"
cacheName="XXXXSessionStore"
<!-- 如果有多个网站,需要用sharedId隔离各自的会话状态。-->
sharedId="XXXXSession" />
</providers>
</sessionState>
另附ClusterConfig.xml内容:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataCache" type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<dataCache size="Small">
<caches>
<cache consistency="StrongConsistency" name="default">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
<cache consistency="StrongConsistency" name="XXXXSessionStore">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
</caches>
<hosts>
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="1178671922" size="2047" leadHost="true" account="XXXX/sr-af-01$"
cacheHostName="AppFabricCachingService" name="sr-af-01" cachePort="22233" />
</hosts>
<advancedProperties>
<securityProperties mode="None" protectionLevel="None" />
</advancedProperties>
</dataCache>
</configuration>
PS:XXXX是屏蔽我们公司的名称。
- 配置ASP.NET网站使用AppFabric Caching存储Session数据
- AppFabric Caching
- 配置AppFabric Caching Server 的缓存客户端
- ASP.NET中使用Caching
- ASP.NET中使用Caching
- ASP.NET中使用Caching
- ASP.NET中使用Caching
- AppFabric Caching Services的使用示例
- Asp.net Core 使用Redis存储Session
- asp.net使用redis存储session(RedisSessionStateProvider)
- 使用 Windows Server AppFabric 缓存编写 ASP.NET 应用程序
- Windows Server AppFabric Caching Service 正式版配置心得
- Windows Server AppFabric Caching支持大数据量的配置
- Windows Server AppFabric Caching
- Windows Server AppFabric Caching
- Windows Server AppFabric Caching
- ASP.NET编程技术-ASP.NET中使用Caching
- Caching in ASP.NET
- 【转】C# winform程序发布后找不到数据文件(xml,ini,etc...)的解决
- A Proof That P Is Not Equal To NP?
- Socket通信-web服务器基本原理(静态)
- pku2409Let it Bead
- 破解Red Hat Enterprise 4的root密码
- 配置ASP.NET网站使用AppFabric Caching存储Session数据
- WebView,WebViewClient,WebChromeClient区别
- 链式队列一些操作
- Squid-3.1.6在CentOS上编译出错提示缺少libltd库
- JS创建Table表单切合并单元格
- Servlet浅识
- Java_开发中:@SuppressWarnings("unchecked")的意思
- servlet学习笔记(一)
- 数据结构之绪论