《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. await之后的线程问题

    之前看了园子里的一篇文章「async & await的前世今生」,收益颇多.而其中有句话被博主特意用红色标注,所以留意多看了几眼,「await 之后不会开启新的线程(await 从来不会开启新 ...

  2. dojo/dom-geometry元素大小

    在进入源码分析前,我们先来点基础知识.下面这张图画的是元素的盒式模型,这个没有兼容性问题,有问题的是元素的宽高怎么算.以宽度为例,ff中 元素宽度=content宽度,而在ie中 元素宽度=conte ...

  3. $.ajax 跨域请求 Web Api

    WepApi确实方便好用,没有配置文件,一个apicontroller直接可以干活了.但今天用$.ajax跨域请求的时候总是获取不到数据,用fiddler一看确实抓到了数据,但回到$.ajax函数中, ...

  4. 我的第一篇Markdown语法博客

    这是我的第一篇使用markdown语法编写的博客 使用的编辑器为Sublime Text2 并且使用了sublog插件, sublog是一个开源项目 sublog 并且参考了作者的博客 AmongOt ...

  5. js中各种跨域问题实战小结(一)

    什么是跨域?为什么要实现跨域呢? 这是因为JavaScript出于安全方面的考虑,不允许跨域调用其他页面的对象.也就是说只能访问同一个域中的资源.我觉得这就有必要了解下javascript中的同源策略 ...

  6. 在cocos2dx和unity3d之间选择

    人生最纠结的事,莫过于有选择………… cocos2dx和unity3d从某种意义上讲,都很不错.但当面对特定需求以及团队情况的时候,总是能分出高下的. 假设,目标游戏是一款类似 刀塔传奇 的游戏 我们 ...

  7. 破解 失控神域 dat文件格式。

    CrackHelper.loadByteArray('../unit_data.dat', function(b:ByteArray):void{ b.uncompress(); var s:Stri ...

  8. 身份证号码查询与生成(C#源码)

    项目要用到这个功能,就写了一个,完整类也就二百来行,很简单.可以在项目中用,也可以作为学习. 源码下载 http://yunpan.cn/cmQCSWkhDnZLJ  访问密码 0227 核心代码如下 ...

  9. swift NSComparator

    var cmptr:NSComparator = {(obj1:AnyObject!, obj2:AnyObject!) -> NSComparisonResult in if((obj1[&q ...

  10. 利用定时器实时显示<input type="range"/>的值

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...