views:

610

answers:

2

I've just installed Velocity on my computer and everything seems to work fine except that I can't add any objects to a cache. I have no trouble retrieving the cache itself, but when I try to add an object, everything just freezes for five minutes, and then I get a time out.

My code to connect to the cache host (works fine):

// Define Array for 1 cache host.
ServerEndPoint[] servers = new ServerEndPoint[1];

// Specify Cache Host Details 
servers[0] = new ServerEndPoint(
       "COMPUTERNAME" /* Host  */, 
       22233 /* Port */, 
       "DistributedCacheService" /* Service name */);

// Pass configuration settings to CacheFactory constructor.
m_cacheFactory = new CacheFactory(servers, 
       true /* Use routing client */, 
       false /* No local cache */);

// Get the cache (works fine).
Cache cache = m_cacheFactory.GetCache("MyCache");

My code to add an object to the cache (don't work):

// Get the cache.
Cache cache = m_cacheFactory.GetCache("MyCache");

// Create the item to put in the cache.
Product product = new Product();
product.Sku = "10000";
product.Name = "My Product";

// Put the object in the cache (The add method doesn't work either).
cache.Put(product.Sku /* Key */, product /* Value */);

Via the cluster administrator interface, I've verified that the cache-host is running and that the cache itself exists.

Anyone have an idea what the problem might be?

EDIT:

I attached a log sink provider to the cache factory, and I've verified that there are some kind of time-out. The cache host is on my local machine and the firewall is turned off.

CASClient - Timed out trying to talk to net.tcp://l1441gbg:22233/distributedcacheservice,Velocity.DRM.SendReceive,Warning,2008-11-20 11:06:29.988

+2  A: 

Did you create the namedCache "myCache" with Secondaries option? I faced the same freezing problem using a single server cluster and creating a NamedCache with -Secondaries 1 option. Seems like the primary server cant duplicate the object you are going to put in the cache. Try to remove the named chache and re-create it with -secondaries 0 option.

Yes. This was actually the problem. Thank you.
Patrik
A: 

Which version do you using? I'm using CTP 3, it works fine for me.

This was CTP 1 a while ago, so it's solved, but thank you for your interest in helping.
Patrik