c# - AppFabric CreateRoutingClient Error -


we have problem appfabric causing below error occur:

exception type: argumentexception  exception message: item same key has been added.     @ system.collections.generic.dictionary`2.insert(tkey key, tvalue value, boolean add)     @ microsoft.applicationserver.caching.datacachefactory.createroutingclient(string cachename, namedcacheconfiguration config)     @ microsoft.applicationserver.caching.datacachefactory.createnewcacheclient(datacachedeploymentmode mode, string cachename, namedcacheconfiguration config, iclientchannel channel)     @ microsoft.applicationserver.caching.datacachefactory.getcache(string cachename)     @ microsoft.applicationserver.caching.datacachefactory.getdefaultcache()     ... our code attempting retrieve cache item default cache key 

this error happens infrequently in our test environment (we have not found scenario reproduce issue on demand), seems happen in our production environment after each deployment. our deployments automated , have verified steps deploy our various environments same.

our server setup given environment follows:

  • server1 - hosts our .net website, , our appfabric 1.1 server
  • server2 - hosts our .net website

these servers load balanced. appfabric local caching has been enabled on both applications. our test , production servers setup same. aware better have appfabric on dedicated server, don't think cause/resolve issue.

we stumped issue have not found mention of elsewhere online , because stack trace seems indicate problem appfabric itself. exception mentions inserting something, doing when happens trying default cache datacachefactory can retrieve item it. so, error mean , how might resolve it?

update

here code using create datacachefactory , pull data cache:

private static readonly lazy<datacachefactory> _data_cache_factory = new lazy<datacachefactory>(() => new datacachefactory()); private static readonly lazy<datacache> _cache = new lazy<datacache>(() => _data_cache_factory.value.getdefaultcache());  public object get(string key) {     return _cache.value.get(key); } 

i 100% duplicate key error generated bad access private _mycache property of datacachefactory. property hashtable. repeated calls hashtable.add("mykey","myvalue"); generate same expection your'e seeing.

i ran multiple tests , calling getcache("default") , getdefaultcache() back doesn't produce error. odd how app fabric trying populate that. here code has never generated error. wanted post reference incase can see different code doing

if (cache == null) {     if(factory == null)         factory = new datacachefactory();      if(string.isnullorwhitespace(cachename))         cachename = configurationmanager.appsettings["app_fabric_cache_name"];      cache = factory.getcache(cachename);     return cache; } 

in above example, cache , factory private static versions of respective types, inside static class called cache.

hope helps


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -