Usando VS2012 he añadido la característica de almacenamiento en caché del almacenamiento en caché Tab WebRole Propiedades. Entre otros, generó el siguiente XML en web.config:azul almacenamiento en caché de ubicación conjunta
<dataCacheClients>
<tracing sinkType="DiagnosticSink" traceLevel="Error" />
<dataCacheClient name="default">
<autoDiscover isEnabled="true" identifier="[cluster role name]"/>
<!-- <localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" /> -->
</dataCacheClient>
</dataCacheClients>
Muy bien, genial. Reemplacé el [nombre del rol del clúster] con el nombre del rol web, di "helloworld.web". Ahora, cuando se crea el objeto DataCacheFactory o DataCache:
_dataCacheFactory = new DataCacheFactory();
_defaultCache = _dataCacheFactory.GetDefaultCache();
//Or, just this line
_defaultCache = new DataCache(@"default");
me sale el siguiente error:
Microsoft.ApplicationServer.Caching.DataCacheException was unhandled
HelpLink=http://go.microsoft.com/fwlink/?LinkId=164049
HResult=-2146233088
Message=ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty.
Source=Microsoft.ApplicationServer.Caching.Client
ErrorCode=21
SubStatus=-1
Some notes:
IDE: VS2012,
Framework: 4.0
AzureSDK: June2012
Local dev machine
¿Qué me falta?
Editar
Yo tengo que trabajar!
que estaba creando el DataCacheFactory en el método WebRole OnStart, lo moví a Application_Start en Global.asax y parece estar funcionando.
Sandrino explica por qué este es el caso: https://stackoverflow.com/a/11886136/1374935
me gustaría saber por qué, sin embargo, y donde sería el mejor lugar para poner el código que inicializa ciertas operaciones tales como la creación de tablas azules, la creación de conexiones de caché, etc. para una aplicación ASP.NET MVC. – States
Consulte: http://stackoverflow.com/a/11886136/1374935 – States
Tengo exactamente el mismo problema pero estoy iniciando la caché desde un controlador MVC. No he hecho nada en Appplication_start. Alguna idea, ¿es un problema similar y me falta algo en la startup? –