session - Co-located cache not working in web role -
my sessions not being cached. using co-located caching on web role.
i have following in web.config:
<configsections> <section name="cachediagnostics" type="microsoft.applicationserver.caching.azurecommon.diagnosticsconfigurationsection, microsoft.applicationserver.caching.azurecommon" allowlocation="true" allowdefinition="everywhere" /> </configsections> ... <datacacheclients> <datacacheclient name="default"> <autodiscover isenabled="true" identifier="website" /> </datacacheclient> </datacacheclients> my cloud service definition (.csdef) follows:
<servicedefinition name="webcloud.test" ...> <webrole name="website" vmsize="small"> <sites> <site name="web"> <bindings> <binding name="endpoint1" endpointname="endpoint1" /> </bindings> </site> </sites> <endpoints> <inputendpoint name="endpoint1" protocol="http" port="80" /> </endpoints> <imports> <import modulename="caching" /> </imports> <startup priority="-2"> <task commandline="microsoft.windowsazure.caching\clientperfcountersinstaller.exe install" executioncontext="elevated" tasktype="simple" /> </startup> </webrole> </servicedefinition> and following in configurationsettings of cscfg file:
<setting name="microsoft.windowsazure.plugins.caching.configstoreconnectionstring" value="defaultendpointsprotocol=http;accountname=accountname;accountkey=accountkey==" /> <setting name="microsoft.windowsazure.plugins.caching.clientdiagnosticlevel" value="1" /> <setting name="microsoft.windowsazure.plugins.caching.namedcaches" value="{"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultttl":10,"isexpirable":true,"type":1},"servernotification":{"isenabled":false}},"secondaries":0}]}" /> <setting name="microsoft.windowsazure.plugins.caching.diagnosticlevel" value="1" /> <setting name="microsoft.windowsazure.plugins.caching.cachesizepercentage" value="20" /> can spot why not working? perhaps identifier set in datacacheclients?
i fixed issue. following needs included in web.config:
<sessionstate mode="custom" customprovider="afcachesessionstateprovider"> <providers> <add name="afcachesessionstateprovider" type="microsoft.web.distributedcache.distributedcachesessionstatestoreprovider, microsoft.web.distributedcache" cachename="default" datacacheclientname="default" applicationname="afcachesessionstate"/> </providers> </sessionstate> this stores asp.net session state in cache.
Comments
Post a Comment