2013-08-04 97 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版的遊戲。 –