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();
BucketConfiguration bc = new BucketConfiguration();
bc.Password = "mypass";
bc.Username = "admin";
bc.BucketName = "NewUserLink";
bc.Port = 11211;
//Initialize the cluster using the default configuration
//Get an instance of the cluster;
private IBucket GetBucket(Cluster cluster, string bucketName)
//Open the default bucket
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" .
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: https://www.couchbase.com/issues/browse/NCBC-514. 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: https://www.couchbase.com/issues/browse/NCBC-515
- You may want to update your sample to DP2: http://blog.couchbase.com/couchbase-net-20-sdk-developer-preview-2. Note that Cluster is now CouchbaseCluster.
If you encounter any other bugs, feel free to open up an NCBC here: https://www.couchbase.com/issues/browse/NCBC and if you can, please include a "how-to-replicate" or project illustrating the issue.