在Azure的云服务实现共同位于会话缓存 [英] Enabling co-located Session Caching in an Azure Cloud Service

查看:124
本文介绍了在Azure的云服务实现共同位于会话缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有一个Azure的云服务托管的MVC应用程序, - 现在 - 使用VIP调剂方法从舞台&LT更新时;>生产,杀死所有会话。我没有做过各地会话管理任何配置,所以这是可以预期的。

Right now I have an Azure Cloud Service hosting an MVC app that - currently - when updated using the VIP swap method from Staging <> Production, kills all sessions. I haven't done any configuration around Session management, so this is to be expected.

我现在正在试图通过以下链接来解决这个问题:

I'm now trying to address this by following this link:

http://www.windowsazure.com/en-us/manage/services/cache/net/how-to-in-role-cache/

我已经启用的角色缓存。我的 dataCacheCLients 是这样的:

I've enabled in-role caching. My dataCacheCLients looks like this:

<dataCacheClients>
    <dataCacheClient name="default">
      <!--To use the in-role flavor of Windows Azure Cache, set identifier to be the cache cluster role name -->
      <!--To use the Windows Azure Cache Service, set identifier to be the endpoint of the cache cluster -->
      <autoDiscover isEnabled="true" identifier="MyRoleName" />
    </dataCacheClient>
  </dataCacheClients>

上面的链接在这里点实际设置的web.config为会话缓存:

The above link points here to actually set the web.config for session caching:

<一个href=\"http://www.windowsazure.com/en-us/manage/services/cache/net/how-to-in-role-cache/#store-session\" rel=\"nofollow\">http://www.windowsazure.com/en-us/manage/services/cache/net/how-to-in-role-cache/#store-session

我已经取消注释在我的web.config,现在看起来像这样的部分(只是会话缓存):

I've uncommented that section (just session caching) in my web.config, which now looks like this:

 <!-- Windows Azure Cache session state provider -->
    <sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
      <providers>
        <add name="AFCacheSessionStateProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheSessionState"/>
      </providers>
    </sessionState>
    <!-- Windows Azure Cache output cache provider -->
    <!--Uncomment this section to use Windows Azure Cache for output cache-->
    <!--<caching>
      <outputCache defaultProvider="AFCacheOutputCacheProvider">
        <providers>
          <add name="AFCacheOutputCacheProvider" type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheOutputCache" />
        </providers>
      </outputCache>
    </caching>-->

现在,当我运行这个地方(不使用仿真器,只是在MVC应用程序IIS),我收到以下错误:

Now, when I run this locally (no emulators used, just the MVC app in IIS), I get the following error:

在发现或指定的地址不能匹配的套接字地址
  家庭。参数名:上下文

None of the discovered or specified addresses match the socket address family. Parameter name: context

我不明白在这里详细的方式很多,它只是被在电源不可用窗口抛出。

I don't get much in the way of details here, it just gets thrown in a Source Not Available window.

所以,认为这可能只是一个局部的问题,我可以大概担心以后,我发布到Azure上。该应用程序运行正常。但是,部署和VIP休息交换会话,所以它似乎没有工作。

So, thinking that this might just be a local issue that I can worry about later, I published to Azure. The app runs fine. But deploying and VIP swapping breaks sessions, so it appears to not be working.

什么引起的?我试图按照所有说明precisely。

What could be causing this? I've attempted to follow all instructions precisely.

有一件事我注意到的是,联系到的最后一篇文章是从Azure的缓存教程 - 我从未设立Azure的缓存,因为我使用的是与我共同位于作用存储帐户(每个previous教程)。这可能是造成这些问题的?

One thing I noticed is that the last article linked to is from the Azure Cache tutorial - I never set up Azure Cache, as I'm using a storage account with my co-located role (per the previous tutorial). What could be causing these issues?

推荐答案

是的,我想你见过有什么是正确的。

Yes I think what you met with is correct.

首先,因为你开始你的MVC应用程序在本地测试失败了。这样,您的应用程序运行不蔚蓝模拟器,这意味着高速缓存客户端无法找到角色名称缓存端点(标识符您在web.config中指定的部分)。我认为,如果你运行你的本地仿真应用程序它应该工作。

First, your local test failed was because you started your MVC application. In this way your application ran without azure emulator which means the cache client cannot find the cache endpoint from the role name (identifier part you specified in web.config). I think it should work if you run your application on local emulator.

第二,当你交换VIP您的会话应该会丢失。在角色高速缓存使用你的一些角色实例内存。当你换贵宾卡,公网IP将被配置到另一个插槽,这意味着你的缓存实例也将被切换。要解决这个问题,我想请你尝试新的缓存服务(preVIEW)。通过这种方式创建专用缓存你的订阅,让您可以在云服务的部署,虚拟机和网站使用它们。

Second, when you swapped VIP your session should be lost. In-Role cache utilizes some of your role instances' memory. When you swapped VIP, the public IP will be configured to another slot which means your cache instances will be switched as well. To fix this problem, I'd like you to try the new Cache Service (Preview). In this way you create dedicate cache for your subscription so that you can use them across cloud service deployments, virtual machines and websites.

希望这有助于。

这篇关于在Azure的云服务实现共同位于会话缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆