Couchbase sessions

We are using SDK 2.6/2.7 (.Net Framework MVC). The Session is not retrieving. It is retrieved as null. Basically it is taking time for retrieval the values. If we make some time delay using Thread.sleep. The session is working fine. Can you please check and advise the below issue.

Version Details

We are using Enterprise Edition 6.0.1 build 2037 ‧ IPv4

We are using .Net 4.6.1 Framework(MVC)

We are using SDK (Couchbase.NetClient)

We are using below DLL version in our applications


#Step 1: Assign session values

public ActionResult Index()


Session[“Hello”] = DateTime.Now.AddDays(-2);

Session[“Test”] = “test-Couchbase-SS”;

return RedirectToAction(“Details”, false);


#Step 2:

public ActionResult Details()



var session = “Session Hello: [” + Convert.ToString(Session[“Hello”]) + “]” + " " + Session[“Test”].ToString(); //Retrive session value is taking more time when we use thread.sleep for testing purpose. It is

working fine

return Content(session);


Sample config Entry:

<add name=“Couchbase” timeout=“20” type=“Couchbase.AspNet.Session.CouchbaseSessionStateProvider,Couchbase.AspNet, Version=, Culture=neutral, publicKeyToken=be12d0a2da0eb156”

bucket=“xyz” username=" " password=" " bootstrapStrategy=“inline”

servers=“https://abc/pools/default/buckets” useSsl=“false” prefix=“ss_portal” throwOnError=“false” />

Hi @mani,

If the Thread.Sleep isn’t there, then it works fine. But when there’s a Thread.Sleep, the value is no longer in session (and returns a null)? Is that correct?

It sounds like the Session is expiring (which is why the value would be null). But I see a timeout of 20 in your configuration. Is it possible that 20 minutes is passing between setting a session value and retrieving it?

yes, Session is returning null. I have increased the value till 72000. Still Session is returning null

<add name="Couchbase" timeout="72000"