Unable to connect to memcached bucket with .NET SDK 2.0.2

Hello,

I have a Couchbase 3.0.2 cluster and trying to work with a memcached bucket using the .NET SDK 2.0.2. Here’s my code:

var config = new ClientConfiguration
{
    Servers = new List<Uri>
    {
        new Uri("http://172.0.0.1:8091/pools"),
        new Uri("http://172.0.0.2:8091/pools"),
        new Uri("http://172.0.0.3:8091/pools"),
    },
    BucketConfigs = new Dictionary<string, BucketConfiguration>
    {
        {
            "default",
            new BucketConfiguration
            {
                BucketName = "distributed_cache",
                Password = "some secret",
            }
        }
    },
};

var cluster = new Cluster(config);
var bucketName = config.BucketConfigs.Single().Value.BucketName;
var bucket = cluster.OpenBucket(bucketName);
var result = bucket.Get<string>("some_key");

The OpenBucket method throws the following exception:

Unhandled Exception: System.AggregateException: Could not bootstrap - check inner exceptions for details. ---> Couchbase.Configuration.ConfigException:  is this a Memcached bucket?
   at Couchbase.Configuration.Server.Providers.CarrierPublication.CarrierPublicationProvider.GetConfig(String bucketName, String password) in d:\work\couchbase-net-client-2.0\Src\Couchbase\Configuration\Server\Providers\CarrierPublication\CarrierPublicationProvider.cs:line 171
   at Couchbase.Core.ClusterController.CreateBucket(String bucketName, String password) in d:\work\couchbase-net-client-2.0\Src\Couchbase\Core\ClusterController.cs:line 163

The exact same code works just fine with Couchbase buckets. Is there some specific way to configure a memcached bucket? Maybe the server urls that are passed should be different and not /pools?

Remark: I was able to successfully consume this memcached bucket from the Java SDK 2.0.

@dimitrod -

The problem is that internally the provider is using the default password (an empty string) instead of what is provided in the configuration. I opened a ticket to fix this: https://issues.couchbase.com/browse/NCBC-824

Note that there is a work-around: use the overload for OpenBucket which takes a bucket name and a password:

cluster.OpenBucket( "distributed_cache", "some secret");

Also, note that in the declaration of the “distributed_cache” above, the key for the configuration should be “distributed_cache” not “default” - the client correctly handles this, but it’s not quite correct here.

BTW, thanks for the great posts, it really makes it easy to diagnose the problem!

-Jeff