0

I have an issue when trying to initiate DataCache in my console/web application. After a long time exception is thrown shown in the image below. I have tried all the ways using DataCacheFactory and simple DataCache but the same issue is occurring. Please help me regarding this issue! Enters image description here

AAJ
  • 19
  • 2

2 Answers2

0

It seems that forgot to configure the .config file. Did you install through Nuget? You must configure your app.config, you must set the "[Cache role name or Service Endpoint]":

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <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" />
  </configSections>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
<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="[Cache role name or Service Endpoint]" />

      <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>
  </dataCacheClients>

Thiago Custodio
  • 17,332
  • 6
  • 45
  • 90
  • I have added the configuration file through Nuget package and also add the service endpoint. – AAJ Feb 14 '14 at 16:13
  • And you created in Windows Azure Management portal too, right!? You'll take the [Cache role name or Service Endpoint] from there. See it: weblogs.asp.net/scottgu/archive/2013/09/03/windows-azure-new-distributed-dedicated-high-performance-cache-service-more-cool-improvements.aspx – Thiago Custodio Feb 14 '14 at 16:25
0

It failing after a long time indicates mostly a network issue. Check for those by seeing if the endpoint you are trying to hit is unreachable or if the dns is resolving properly etc.

Are you disposing the datacachefactory ? The endpoint should be the fullthing given by the cache portal : yourchosencahcename.cache.windows.net

Ankit Sud
  • 102
  • 4