Simple C# Connection

I’m very new to couchbase and I’m trying to get the C# driver to just connect to a cluster I configured and pull from the beer sample.

I imported the drive via NPM in Visual Studio 2013 and I’m trying to follow along with http://docs.couchbase.com/couchbase-sdk-net-1.2/#try-it-out but I"m not having much luck getting any kind of output. The console application pops up, displays nothing and waits for the input key to be hit.

static void Main(string[] args) { var client = new CouchbaseClient(); var savedBeer = client.Get("21st_amendment_brewery_cafe"); Console.WriteLine(savedBeer); Console.Read(); }

In my app.config I’m using











Can anyone point me in the right direction?

Hi dbassassin -

Nice name and avatar!

Do you have the beer-sample bucket installed? If not login to the console manager and select the Settings tab, Sample Buckets and check the beer-sample sample bucket, then Create.

If you do have the “beer-sample” bucket installed, make sure you can connect to the cluster. Note that Fiddler and other HTTP debuggers (as well as Anti-Virus, firewalls etc) will block streaming HTTP connection that is made from client while bootstrapping.

Notice that you are using the CouchbaseClient.Get(…) method? Switch to the CouchbaseClient.ExecuteGet(…) method and check and see what the Message and Status fields have set in the returned IOperationResult return object.

LMK how this goes,

-Jeff

Nice name and avatar!

Jeff,

Thanks for the reply.

I did install the samples during setup. When I use client.ExecuteGet() the console outputs

Enyim.Caching.Memcached.Results.GetOperationResult

When checking my locals I’m seeing the base message of “Unable to locate node” with a StatusCode of 146

So, either your ip is wrong in your config, or something is blocking the bootstrapping process. Usually it’s fiddler, but could be your A/V or firewall.

BTW - what you see in your locals can be outputted by doing: result.Message or result.StatusCode.ToEnum().

-Jeff

Thanks to the help of Jeff I was able to narrow down the scope of troubleshooting.

I was able to open up http://ip_of_node1:8091/pools and http://ip_of_node1:8091, which made things a little more confusing.

When I changed the following code:








to








I was able to connect and retrieve the record.

So in case anyone else has this issue, use the hostname of the nodes in the cluster, not the ip address.

Cheers