2013-08-04 99 views
2

我完全丧失了获取共享缓存的功能。在本地和云上配置天蓝色共享缓存

本地,我有一个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> 

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

_cache = new DataCache("default"); 

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

回答

4

请确保您使用SDK版本2.1。 Caching 2.1软件包仅适用于最新版本的SDK(请参阅下面的屏幕截图)。你可能想在这里看看这个线程:Exception while using Windows Azure Caching : No such host is known

enter image description here

+2

你的先生是一个绅士和学者。我找到了更新的sdk [here](http://www.windowsazure.com/en-us/downloads/)并安装了2.1版本 - 再见了,hello网页。由于我刚刚开始使用Azure,所以我一定错过了2.1版的游戏。 –