Hello,
I am currently using CouchbaseNetClient 2.2.7, connecting to a test cluster running CB community 3.0.1. Memcached bucket type.
When connecting to a memcached bucket using configurations in app config, I get an access denied error. Overriding the app config by adding bucket name and password to the OpenBucket() call allows me to connect without any problem.
This seems rather similar to what described in NCBC-824, supposedly fixed in client 2.0.2.
To reproduce:
[edit - config copied from sample on SDK documentation, relevant line is this}:
I think your problem is the bucket name. Calling OpenBucket without any bucket name will always try to open a bucket named âdefaultâ, but your bucket appears to be named âtestâ. Try calling OpenBucket(âtestâ), that should automatically use the password from your configuration file.
My code is copied verbatim from the documentation for the .net sdk when using an app.config file (under âconfiguring the clientâ, see below). If the behavior is âby designâ, then the docs are incorrect.
using (var cluster = new Cluster("couchbaseClients/couchbase")) { using (var bucket = cluster.OpenBucket()) { //use the bucket here } }
IMHO, having to define the bucket name in code defeats the purpose of having this configurable in the app.config file. Sometimes you might want to release a package that can be deployed by only changing the config files, and not recompiling.
The workaround is trivial (just add bucket name and PW as variables somewhere else in the app.config file and then use these as parameters when opening the bucket}, but it is somewhat inelegant.
You make a good point; the reason OpenBucket() doesnât just open the configured bucket is because you could have multiple buckets defined and which one would we chose?
We are open to improving this, however, so feedback is always appreciated.
Just to be clear, you donât need to put the password elsewhere in your config. It will use the password the way you have it configured. You just need to include the bucket name in the OpenBucket call, like .OpenBucket(âtestâ)