《Windows Azure Platform 系列文章目录

  Update 2016-01-12

  https://azure.microsoft.com/zh-cn/documentation/articles/cache-dotnet-how-to-use-in-role/

  微软宣布Azure Managed Cache Service和Azure In-Role Cache会在2016年11月30日下线,建议所有的用户采用Redis Cache。

  有关Redis Cache的内容,请参考:

  http://www.cnblogs.com/threestone/category/741409.html

  在上一篇的博文中Windows Azure Cloud Service (42) 使用Azure In-Role Cache缓存(1)Co-located Role

  笔者介绍了如何使用Co-located Role Cache来使用缓存,本章部分内容与该博文重复,请各位读者提前预习相关知识。

  本篇博客,笔者将介绍使用Dedicated Role Cache。

  为什么要使用Dedicated Role Cache?

  Co-located Role(共享模式)的Cache,是保存在多个Cloud Service Instance上的。

  在某些情况下,企业网站的负载非常大,这时候,就需要额外的Dedicated Role Cache来专门负责Caching。

  

  Co-located Role的架构图,请参考http://weblogs.asp.net/scottgu/meet-the-new-windows-azure

  

  接下来开始本章内容:

  1.使用管理员身份,运行Visual Studio 2013,创建一个新的Cloud Project,命名为LeiDedicatedRole。图略。

  2.在New Windows Azure Cloud Service中,添加Web Role和Cache Worker Role。如下图:

  

  3.我们点击Cloud Project,选择WebRole1,右键,选择Properties。如下图:

  

  将Web Role的Instance Count设置为2。(Web Role Instance设置为2或者2以上,就实现了高可用。)

  

  

  4.配置完WebRole1后,我们接下来配置CacheWorkerRole,如下图:

  

  将CacheWorkerRole的Instance设置为2(或者2以上,配置高可用),图略

  

  5.然后继续配置CacheWorkerRole的Caching信息,如下图:

  

  (1)默认已经勾选了Enable Caching

  (2)设置了Dedicated Role

  (3)设置Storage Account,因为Cache Cluster(PaaS Web Role Instance)会将Runtime的信息保存在Storage,所以这里一定要设置正确

  (4)Named Cache默认是default,我们可以通过Add Named Cache,增加新的Cache Name。

  另外,笔者在步骤4设置了Instance Count=2,所以我们可以勾选High Availability,保证高可用。这样不会因为某台Cache Worker Role Instance因为故障宕机导致Caching丢失

  6.然后我们在WebRole配置NuGet,增加Windows Azure Cache的引用。图略。具体请参考Windows Azure Cloud Service (42) 使用Azure In-Role Cache缓存(1)Co-located Role

  7.修改WebRole1下的Web.config,找到autoDiscover节点,如下图:

  

  将上图中的[Cache role name or Service Endpoint]中的节点,修改为项目文件的Cache Worker Role Name,在笔者的Sample Code中,我们设置为CacheWorkerRole1

  设置完毕后的结果如下图:

  

  这样相关的配置就完成了。

  参考资料:http://blog.sanc.idv.tw/2012/06/windows-azure-windows-azure.html

Windows Azure Cloud Service (43) 使用Azure In-Role Cache缓存(2)Dedicated Role的更多相关文章

  1. Windows Azure Cloud Service (36) 在Azure Cloud Service配置SSL证书

    <Windows Azure Platform 系列文章目录> 在某些时候,我们需要在Azure PaaS Cloud Service配置HTTPS连接.本章将介绍如何在本地创建证书,然后 ...

  2. Windows Azure Cloud Service (42) 使用Azure In-Role Cache缓存(1)Co-located Role

    <Windows Azure Platform 系列文章目录> Update 2016-01-12 https://azure.microsoft.com/zh-cn/documentat ...

  3. Windows Azure Cloud Service (11) PaaS之Web Role, Worker Role(上)

    <Windows Azure Platform 系列文章目录> 本文是对Windows Azure Platform (六) Windows Azure应用程序运行环境内容的补充. 我们知 ...

  4. [SDK2.2]Windows Azure Cloud Service (35) 使用VS2013发布Azure Cloud Service

    <Windows Azure Platform 系列文章目录> 好久没有更新BLOG了,今天我们继续Windows Azure相关的内容. 笔者最近把Visual Studio升级到了20 ...

  5. Windows Azure Cloud Service (38) 微软IaaS与PaaS比较

    <Windows Azure Platform 系列文章目录> 最近一直想总结Azure IaaS和PaaS的区别与比较,写个博文详细说明一下.建议读者在阅读之前,先熟悉微软PaaS和Ia ...

  6. Windows Azure Cloud Service (39) 如何将现有Web应用迁移到Azure PaaS平台

    <Windows Azure Platform 系列文章目录> 本文将简单介绍,如何将企业内现有的ASP.NET应用程序迁移到Azure PaaS平台. 因为在迁移过程中,可能需要对现有的 ...

  7. Windows Azure Cloud Service (44) 将Cloud Service加入Virtual Network Subnet,并固定Virtual IP Address(VIP)

    <Windows Azure Platform 系列文章目录> 在之前的文章中,笔者已经详细介绍了如何将Virtual Machine加入Virtual Network,并且绑定固定的Pr ...

  8. Windows Azure Cloud Service (47) 修改Cloud Service时区

    <Windows Azure Platform 系列文章目录> 本文介绍内容适合于Azure Global和Azure China 我们在使用Cloud Service的时候,会发现默认的 ...

  9. 如何使用 OneAPM 监控微软 Azure Cloud Service ?

    不知不觉微软 Azure 已经进入中国市场近两年的时间.那么 Azure 平台的性能究竟如何?资源加载的延迟.虚拟机的稳定性等问题是否切实满足客户期许.这些都是大家对微软 Azure 这个国外的云服务 ...

随机推荐

  1. Docker Machine v1.11.2安装与使用

    官方文档:Docker Machine 官方文档:Docker Toolbox boot2docker安装包官网下载链接:Docker Toolbox-1.11.1b.exe 此安装包包含的“boot ...

  2. 创建动态WCF服务(无配置文件)

    public class WCFServer { ServiceHost host = null; public WCFServer(string addressurl, string tcpurl, ...

  3. javascript 设计模式-----工厂模式

    所谓的工厂模式,顾名思义就是成批量地生产模式.它的核心作用也是和现实中的工厂一样利用重复的代码最大化地产生效益.在javascript中,它常常用来生产许许多多相同的实例对象,在代码上做到最大的利用. ...

  4. mongodb(Index)

    备忘mongoDb 索引的一些知识点. 1.索引是用以加速数据库查询的手段,在mongo中主要是采用B树的方式: 2.每个集合最多可增加64个索引,不建议增加过多索引,原因在于一是索引本身占用空间,二 ...

  5. C#抓取网页HTML内容

    网上很多内容采集工具,今天就自己试着写一个,发现C#可以轻松的抓去网页的内容,进而通过正则来分离出自己感兴趣的数据.下面是抓去网页内容的代码: using System; using System.C ...

  6. 使用Async和Await进行异步编程(C#版 适用于VS2015)

    你可以使用异步编程来避免你的应用程序的性能瓶颈并且加强总体的响应.然而,用传统的技术来写异步应用是复杂的,同时编写,调试和维护都很困难. VS2012介绍了简单的方法,那就是异步编程,它在.Net F ...

  7. Oracle数据库面试题【转载】

    1. Oracle跟SQL Server 2005的区别? 宏观上: 1). 最大的区别在于平台,oracle可以运行在不同的平台上,sql server只能运行在windows平台上,由于windo ...

  8. Atitit 图像扫描器---基于扫描线

    Atitit 图像扫描器---基于扫描线 调用范例 * @throws FileExistEx */ public static void main(String[] args) throws Fil ...

  9. Atitit blend mode COLOR_DODGE 混合模式  “颜色减淡”模式

    Atitit blend mode COLOR_DODGE 混合模式  "颜色减淡"模式 1.1. 混合模式是图像处理技术中的一个技术名词1 1.2. 目录1 1.3. 颜色减淡C ...

  10. js 判断字符串是否包含另外一个字符串

    示例代码: <script type="text/javascript"> var str = "测试一个字符串(ehtrzes)是否包含另外一个字符串&qu ...