in Cloud configuration file looks like,
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.NamedCaches" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.Loglevel" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.CacheSizePercentage" value="30" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="UseDevelopmentStorage=true" />
In service definition file looks like,
<Import moduleName="Caching" />
<LocalResources>
<LocalStorage name="Microsoft.WindowsAzure.Plugins.Caching.FileStore" sizeInMB="1000" cleanOnRoleRecycle="false" />
</LocalResources>
In a default.asox page i have one textbox and button.In button click i put this code to check while it is working correct or not.
namespace for this page as
using System.Web.Caching;
using System.Diagnostics;
using System.Threading;
using Microsoft.ApplicationServer.Caching;
protected void btnsubmit_Click(object sender, EventArgs e)
{
var name = txtName.Text;
if (string.IsNullOrWhiteSpace(name))
{
lblResult.Text = "Error. Please specify name.";
return;
}
bool cached;
var sw = new Stopwatch();
sw.Start();
// create the cache factory and cache
var factory = new DataCacheFactory();
var cache = factory.GetDefaultCache();
// check if the name specified is in cache
// var email = cache.Get(name) as string;
var email = "mm@gmail.com";
if (email != null)
{
cached = true;
sw.Stop();
}
else
{
cached = false;
// simulate the letancy
Thread.Sleep(2000);
email = string.Format("{0}@igt.com", name);
// add to cache
cache.Add(name, email);
}
sw.Stop();
lblResult.Text = string.Format(
"Cached = {0}. Duration: {1}s. {2} => {3}",
cached, sw.Elapsed.TotalSeconds.ToString("0.00"), name, email);
}
}
In web.config file it looks like,
Session state and outputcache as follows,
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
<providers>
<add name="AppFabricCacheSessionStoreProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" useBlobMode="false"
/>
</providers>
</sessionState>
<caching>
<outputCache defaultProvider="DistributedCache">
<providers>
<add name="DistributedCache" type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" />
</providers>
</outputCache>
</caching>
In Configsections of the web.config file,<configSections>
<!-- Append below entry to configSections. Do not overwrite the full section. -->
<section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" />
</configSections>
and in configuration section as looks,
<dataCacheClients>
<tracing sinkType="DiagnosticSink" traceLevel="Error" />
<dataCacheClient name="default">
<autoDiscover isEnabled="true" identifier="WebRole1" />
<!--<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />-->
</dataCacheClient>
</dataCacheClients>
I apply Caching(Preview) and sdk version 1.7.Without caching applying its working fine. After applying Caching it shown when deploying
Instance 0 of role WebRole1 is busy
11:56:58 AM - Instance 1 of role WebRole1 is busy
12:44:35 PM - Instance 0 of role WebRole1 is cycling
12:44:35 PM - Instance 1 of role WebRole1 is cycling
more than 4 hours.how should i resolve this. Anyone help me as soon as possible. Am stuck more than one week.
P.Mythili