i tried running the example Couchbase.NetDP1 in C#.
I changed the code so i connect to my server and bucket:

private void button1_Click(object sender, EventArgs e)
Cluster cluster = InitializeCluster2();
var bucket = GetBucket(cluster, “NewUserLink”);

private Cluster InitializeCluster2()
//Create a custom configuration specifiy a max pool size of 10
ClientConfiguration configuration = new ClientConfiguration();

        configuration.Servers.Add(new Uri(""));

        BucketConfiguration bc = new BucketConfiguration();
        bc.Password = "mypass";
        bc.Username = "admin";
        bc.BucketName = "NewUserLink";

        bc.Port = 11211;

        configuration.BucketConfigs.Add("NewUserLink", bc);

        //Initialize the cluster using the default configuration

        //Get an instance of the cluster;
        return Cluster.Get();

private IBucket GetBucket(Cluster cluster, string bucketName)
//Open the default bucket

        return cluster.OpenBucket(bucketName);

when i run it i get message: when i use the default port and bot set the bc.port i get message: “Invalid URI: Invalid port specified.” when i set the port to my bucket port 11211 i get the message: “Object reference not set to an instance of an object” in line “cluster.OpenBucket” .
any idea?

Hi rubynadler -

There are a couple things going on here:

  • Looks like you found a bug! Internally, when the OpenBucket(bucketName) is called, it overrides the configured password with an empty string (which is the default password). This will be fixed in Beta 1, the ticket can be found here: As a work-around, you should be able to call OpenBucket(bucketName, password) and connect successfully.
  • I see your using port 11211, which is the proxy port for clients using Moxi. The .NET client doesn't use Moxi, so this isn't a valid configuration. The ticket for this is here:
  • You may want to update your sample to DP2: Note that Cluster is now CouchbaseCluster.

If you encounter any other bugs, feel free to open up an NCBC here: and if you can, please include a “how-to-replicate” or project illustrating the issue.



when i try to change the bucket port on the server console to 11210 i get message that the port is already in use. the default port of the bucket is 11211 (and you say i can not connect with). so i changed the port to different port. in the c# code i changed the property of the port to the same port and get message:“No connection could be made because the target machine actively refused it”.