Cannot get the bucket opened using dotnet sdk

Cannot get the bucket opened using dotnet sdk.

The code snippet below followed by the error message picture

        ClientConfiguration configuration = new ClientConfiguration();
        configuration.PoolConfiguration.MaxSize = 10;
        configuration.PoolConfiguration.MinSize = 10;
        configuration.Servers.Clear();
        configuration.Servers.Add(new Uri("test.oiiad.com:8091"));
        BucketConfiguration bc = new BucketConfiguration();
        bc.Password = "pass";
        bc.Username = "Administrator";
        bc.BucketName = "myBucket";
        configuration.BucketConfigs.Clear();
        configuration.BucketConfigs.Add("NewUserLink", bc);
        configuration.UseSsl = false;
        ClusterHelper.Initialize(configuration);
        var bucket = ClusterHelper.GetBucket("myBucket");


	**Message	"Cannot get Info if HttpProvider has not been initialized"	string**

Hi @rkbnair-

Can you provide:

  • SDK version
  • Server version
  • Client logs when the error is occurring.

The error message is interesting given that the only reference to that error is in a deprecated method. One thing I do see is that when you add the BucketConfiguration to the BucketConfigs dictionary is that the key does not match the bucket name; try changing “NewUserLink” to “myBucket”.

-Jeff

I would also point out that you may have authentication configured incorrectly for the bucket. If you’re using Couchbase 5.0 Beta it looks okay, but for 4.6 and earlier each bucket has it’s own password. It’s not using the Administrator password used to access management functions.

CouchbaseNetClient v2.4.7

Version: 4.6.2-3905 Enterprise Edition (build-3905)
Cluster State ID: 01A-040-412

client Logs…i have to look at the steps.

Tried changing “NewUserLink” to “OIIBusinessCards”; getting the following error:

I tried

var bucket = ClusterHelper.GetBucket(“MyBucket”, “myPassword”);

But still no luck

@rkbnair -

The Username field only pertains to Couchbase 5.0 or greater versions which use RBAC (Role Based Access Control). Since you are using pre-5.0 version of Couchbase:

The SDK is trying to run through RBAC authentication, which will fail on the version of Couchbase Server you are using. You should be able to Auth by removing the Username value and just using:

-Jeff

Tried removing username/password:

Still getting these errors:

@rkbnair -

Using the debugger, your invoking the Info property which is flagged as obsolete, meaning you shouldn’t use it. The compiler even tells you to use “Use CreateManager(user, password).ClusterInfo() instead” Is there any reason why you are doing this? That property has nothing to do with bucket operations; instead it provides some cluster information.

-Jeff

Actually, I am not doing it. Info property is automatically visible when i do these actions

        ClientConfiguration configuration = new ClientConfiguration();
        configuration.PoolConfiguration.MaxSize = 10;
        configuration.PoolConfiguration.MinSize = 10;
        configuration.Servers.Clear();
        configuration.Servers.Add(new Uri("HOURNDDB1.oiiad.com:8091"));

        BucketConfiguration bc = new BucketConfiguration();
        bc.BucketName = "OIIBusinessCards";

        configuration.BucketConfigs.Clear();
        configuration.BucketConfigs.Add("OIIBusinessCards", bc);
        configuration.UseSsl = false;
        ClusterHelper.Initialize(configuration);
        var bucket = ClusterHelper.GetBucket("OIIBusinessCards");

@rkbnair -

It’s only visible through your Locals or drilling into a Watch which explicitly executes the code; which is what you are doing in your screenshots. You can also execute it by doing this:

cluster.Info(); 

Going deeper into this, if you were to open a Memcached bucket, calling cluster.Info() might succeed because Memcached buckets use HttpStreamingProvider which this method requires to work. Couchbase buckets bootstrap using CarrierPublicationProvider which is not supported by this method. All of this is the reason why this method is deprecated and flagged as obsolete.

-Jeff

I am not a fan of using the code that I uses. All I wanted to do is connect to a remote server to access couchbase data…that simple

If someone can show a better sample, I will do that.

Actually, the code I uses currently is something I received by a google search.

@rkbnair -

There doesn’t appear to be anything wrong with your code:

image

Once the bucket is opened, I can execute K/V against the cluster using it.

-Jeff