Web application raised error after restart memcacheD


I'd make the code as below; It works fine in normal situation. But, I restart memcacheD as failure situation. Then, it raised error. So, I restart my IIS, then it's OK.
Please let me know the resolution.
        int top_count = 10;
        string key = "keyname" + top_count.ToString();
        object ds = DistCache.Get(key);
        if (ds == null)
            SqlConnection cn = new SqlConnection(connectionString);
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cn;
            cmd.CommandText = "dbo.sp";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandTimeout = 0;
            SqlParameter param = new SqlParameter("@top_count", SqlDbType.Int);
            param.Value = top_count;
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataSet dsSet = new DataSet();
            bool b = DistCache.Add(key, dsSet, 3000);
            if (b == false)
            cmd.Connection = null;
            ds = DistCache.Get(key);
Closed Aug 11, 2010 at 3:09 PM by fahadaz


fahadaz wrote Sep 11, 2009 at 1:43 PM

The problem is with the sockets that are used by memcached client. If memcached dies out. Those sockets will be open until the time out value set in the
web.config is reached. If this value is set as a higher number like a couple of minutes or more it will be stuck till then and after that server will be marked as
dead. If there is only one memcached server in the pool then memcached provider would not work anymore.
  • Fahad

wrote Aug 11, 2010 at 3:09 PM

wrote Feb 14, 2013 at 8:18 PM

wrote May 16, 2013 at 10:11 AM