【问题标题】:Configure azure shared cache locally and on the cloud在本地和云端配置 Azure 共享缓存
【发布时间】:2013-08-04 16:55:05
【问题描述】:

让共享缓存正常工作我完全不知所措。

在本地,我正在运行一个 mvc4 站点,并由此创建了一个云项目。我在角色上启用了缓存并将其设置为共同定位。到目前为止一切都很好。

我从 NuGet 添加了 Windows Azure Caching 2.1 包,它安装了相关库并更新了我的 Web 配置:

configSections

<section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" />
<section name="cacheDiagnostics" type="Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsConfigurationSection, Microsoft.ApplicationServer.Caching.AzureCommon" allowLocation="true" allowDefinition="Everywhere" />

配置

<dataCacheClients>
<dataCacheClient name="default">
  <!--To use the in-role flavor of Windows Azure Caching, set identifier to be the cache cluster role name -->
  <!--To use the Windows Azure Caching Service, set identifier to be the endpoint of the cache cluster -->
  <autoDiscover isEnabled="true" identifier="" />
  <!--<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />-->
  <!--Use this section to specify security settings for connecting to your cache. This section is not required if your cache is hosted on a role that is a part of your cloud service. -->
  <!--<securityProperties mode="Message" sslEnabled="false">
    <messageSecurity authorizationInfo="[Authentication Key]" />
  </securityProperties>-->
</dataCacheClient>

当我按照说明将角色名称添加到 autoDiscover 元素上的 identifer 属性并运行应用程序时,它似乎只是挂起(我假设失败):

_cache = new DataCache("default");

我正在运行存储模拟器并从计算模拟器进行站点调试。我似乎无法将站点配置为使用 azure 缓存。

【问题讨论】:

    标签: c# azure shared-cache


    【解决方案1】:

    请确保您使用的是 SDK 2.1 版。 缓存 2.1 包仅适用于最新版本的 SDK(请参见下面的屏幕截图)。您可能想在此处查看此线程:Exception while using Windows Azure Caching : No such host is known

    【讨论】:

    • 您先生是一位绅士和一位学者。我找到了更新的 sdk here 并安装了 2.1 版本 - 再见冻结,你好网页。我一定是错过了 2.1 的机会,因为我才刚刚开始使用 Azure。
    猜你喜欢
    • 2020-09-06
    • 1970-01-01
    • 2016-06-15
    • 2018-08-23
    • 2013-04-02
    • 2022-08-10
    • 2015-06-25
    • 2014-07-01
    • 1970-01-01
    相关资源
    最近更新 更多