通过使用Microsoft.Web.DistributedCache可直接将AppFabric Cache用于Session与Cache存储。直接贴配置,很简单。

1、配置configSections, 在configurtion节点下添加以下节点内容:

configSections

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

2、在configSections节点后添加dataCacheClient节点配置

dataCacheClient

<!-- cache client -->

<dataCacheClient>
 
  <!-- cache host(s) -->

<hosts>

<host
       
          name="CacheServer1"
   
          cachePort="22233"/>

</hosts>

</dataCacheClient>

3、在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>

以下是一个完整的配置示例:

完整示例

<?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="CacheServer1"
         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>

如果要用做默认的缓存提供程序,只需要在System.Web里面增加Cache相关的节点配置点配置即可,示例如下:

代码

<caching>
      <outputCache defaultProvider="AppFabric">
        <providers>
          <add
             name="AppFabric"
type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider,Microsoft.Web.DistributedCache"
 cacheName="default" />
        </providers>
      </outputCache>
    </caching>

相关下载:/Files/zsea/AppFribc.zip

转载于:https://www.cnblogs.com/zsea/archive/2010/08/27/1809867.html

AppFabric客户端的一些配置(Microsoft.Web.DistributedCache)相关推荐

  1. 为什么获取crm服务器信息失败,为 Outlook 配置 Microsoft Dynamics CRM 客户端时出现 与 Microsoft Dynamics CRM 服务器通信时出现问题 错误...

    症状 当您尝试配置 microsoft Office Outlook 的 Microsoft Dynamics CRM 客户端时,收到以下错误消息: 与 Microsoft Dynamics CRM ...

  2. Outlook Express邮件客户端的自动化配置

    出处:  http://www.cnblogs.com/blodfox777/archive/2009/01/13/1374907.html Outlook Express邮件客户端的自动化配置 在部 ...

  3. 运行php能运行asp么,配置使web server即能运行asp又能运行PHP(不装Apache)

    配置使web server即能运行asp又能运行PHP(不装Apache) 时间:2006/7/19 13:36:01 作者:佚名 人气:57 支持ASP不用多余的设置,只要按正确安装了IIS4或II ...

  4. 《虚拟化安全解决方案》一2.3 在Windows Server 2008上配置Microsoft Hyper-V

    本节书摘来自华章出版社<虚拟化安全解决方案>一书中的第2章,第2.3节,作者[美]戴夫·沙克尔福(Dave Shackleford),更多章节内容可以访问云栖社区"华章计算机&q ...

  5. SpringCloud(第 029 篇)配置客户端 ConfigClient 接入配置服务端

    SpringCloud(第 029 篇)配置客户端 ConfigClient 接入配置服务端 - 一.大致介绍 1.有配置服务端,那么势必就会有与之对应的客户端,SpringCloud 文档中集成也非 ...

  6. C#操作IIS站点 Microsoft.Web.Administration.dll

    利用IIS7自带类库管理IIS现在变的更强大更方便,而完全可以不需要用DirecotryEntry这个类了(网上很多.net管理iis6.0的文章都用到了DirecotryEntry这个类 ),Mic ...

  7. oracle客户端免安装配置、64位机器PL/SQL和VS自带的IIS连接问题

    一.oracle客户端免安装配置 1.到oracle官网下载Oracle InstantClient, 把它解压缩到单独目录,例如C:\OracleClient, 2. 添加环境变量 ORACLE_H ...

  8. IIS客户端证书访问配置

    一.         测试环境配置... 1<?xml:namespace prefix = o /> 1.           win2003系统_1.. 1 1.1.         ...

  9. linux nfs系统客户端,Linux系统中挂载共享目录NFS文件系统客户端安装与配置

    NFS服务简介      NFS是Network  File System(网络文件系统).主要功能是通过网络让不同的服务器之间可以共享文件或者目录.NFS客户端一般是应用服务器(比如web,负载均衡 ...

最新文章

  1. apollo mqtt linux qt,MQTT第5版更新,以及如何应用到Qt MQTT模块中
  2. Dos 改动IP 地址
  3. EXT4.2--Ext Designer 使用
  4. 相机成像原理_数码相机的工作原理
  5. 无数踩坑系列(1)--Brightness Controller
  6. Mybatis学习笔记13 - 动态sql之set标签
  7. 【OpenCV 例程200篇】01. 图像的读取(cv2.imread)
  8. AngularJS Filters
  9. LeetCode 40. 组合总和 II(回溯)
  10. C/C++[PAT B level 1004,1012]
  11. 使用AUTODYN超高速撞击仿真
  12. (已更新)漫画小程序,自动采集资源,漫画源码简单即可发布
  13. 《21天学通C语言》
  14. 移动硬盘访问错误 - 磁盘结构损坏且无法读取、拒绝访问
  15. 【Java 8 新特性】Java Comparator.nullsLast | 将空元素被认为大于非空元素
  16. BP误差反传神经网络
  17. 疯狂Android讲义(一)——第一部分
  18. ASCII-from baidubaike
  19. 电脑垃圾清理,恶意软件清理,C盘清理
  20. Remix-IDE安装开发环境与使用文档(Windows环境)

热门文章

  1. C++_类和对象_对象特性_友元_全局函数做友元_在类中声明友元权限的全局函数来访问_类中的private权限的变量---C++语言工作笔记052
  2. Netty工作笔记0014---Buffer类型化和只读
  3. 项目投标注意点001---项目投标那点事
  4. security框架工作笔记001--- Shiro和Spring Security对比_智慧城市项目中选型用Spring Security
  5. 倒序排序_排序不等式,切比雪夫不等式及伯努利不等式
  6. 《统计学习方法》读书笔记——朴素贝叶斯法(公式推导+代码实现)
  7. qtabbar设置不同宽度_透水地坪需要设置伸缩缝吗?
  8. 河南省2020年计算机高考真题,2020年最新版对口高考试卷(计算机).docx
  9. c++ socket线程池_从连接器组件看Tomcat的线程模型——NIO模式
  10. 如何让地面不起灰_解决水泥地面起灰的省钱方法