Unable to store data via .Net Client

I am trying to build the Hello World sample for CouchBase on Windows, but I am unable to save anything.
When I tried the ExecuteStore() method it returned IStoreOperationResult with the message "Failed to locate node".
here is my app.config file -

 
<?xml version="1.0"?>
<configuration>
 
  <configSections>
    <section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
  </configSections>
 
  <couchbase>
    <servers bucket="default" bucketPassword="" >
      <add uri="http://127.0.0.1:8091/pools" />
    </servers>
  </couchbase>
 
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

CouchBase console says everything is working fine.

has anyone came across this kind of issue before?

1 Answer

« Back to question.

Usually that error indicates the client library can't get it's configuration from the cluster.

I'd recommend trying to turn on/up logging, and you'll probably see more. The configuration fetching happens in another thread, so most feedback is available via the logging. See the docs for more on logging.

Same problem here.

I try to run the sample code, but it does always return false, when trying to write.

COUCHBASE 2.0, preview 4
on localhost
Visual Studio 2012

Will have to try logging...

Do let us know how things work out. If there's a problem, we'll want to resolve it. As always, verify the firewall setup is correct, etc.

Generally speaking, if you can see/use the web console, then the client library should be able to get its configuration as well. If you can't see the web console, then sometimes on windows you need to adjust the hostname/IP address:
http://www.couchbase.com/docs/couchbase-manual-1.8/couchbase-bestpractic...

Many development environments just set it to '127.0.0.1' or 'localhost', which wouldn't allow clustering but makes development locally more reliable as you move a laptop around.

For me the following setup does NOT work (not locally, nor with a proper remote server):

localserver: 2.0-preview4 under windows 7
remote: 2.0-preview4 under XenServer - Ubuntu Server 12.04
.net client: .NET 1.2 (dubed "couchbase 2.0 compatible")

I found this solution for me:
-> just use the old .net client and everything works like a charm

.net client: .NET 1.1 (dubed "couchbase 1.8 compatible") (same server 2.0 configuration!)

Try to use .net client 1.2 and try to add 2 string to your config (especially 2nd string):

 <documentNameTransformer type="Couchbase.Configuration.DevelopmentModeNameTransformer, Couchbase" />
  <httpClientFactory type="Couchbase.HammockHttpClientFactory, Couchbase" />

Then your config should look like:

<couchbase>
  <documentNameTransformer type="Couchbase.Configuration.DevelopmentModeNameTransformer, Couchbase" />
  <httpClientFactory type="Couchbase.HammockHttpClientFactory, Couchbase" />
  <servers bucket="default" bucketPassword="securepass">
    <add uri="http://127.0.0.1:8091/pools/default" />
  </servers>
</couchbase>

My config worked for me with Windows + 2x Linux (ubuntu) Coucbase DP4 x86_64 cluster with .net 1.2 library.

Hi folks!

After running into some problems with accessing Couchbase Server 2.0 with the .net client .NET 1.1 , I was forced to try again with the .NET 1.2 client

This time I took the official NuGet Package for .NET client (which is still 1.1), replaced the .dlls within with the downloaded .NET 1.2 versions and loaded that Package into my environment.
That did the trick for me. Without any changes in my code, now everything works fine. Problems vanished.
Thought this might help other people with problems using the .NET 1.2 client on Couchbase_2.0_preview4

Cheers,
Jimmy

PS: I LOVE COUCHBASE 2.0 !!

Besides...

The tip from SkeLLLa, in the previous message (adding the two extra web.config entries) prooved to be essential too.

So make sure that these two lines are there or it won't work.

Thanks Skella, for your help!
Jimmy

Please note with the Beta release of the .NET Client, those two new 1.2 elements do have defaults and are no longer required.

Hello,

I have this same problem. I've tried so many different ways of resolving it, I'm not sure where I'm even at :(

I'm using 1.8.1 community edition
I'm using .net Enyim 2.12.0 and Couchbase 1.1.6 - I installed these with NuGet
When I browse to the uri in my web.config file, the results are as expected.

However, when I try to store data I get "Failed to locate node"

Any troubleshooting suggestions would be appreciated.

Could you post your config and code?

Hi guys, I have noticed the same and in my case i had downloaded the source for each depended library of couchbase .net 1.2 and noticed that the distribution .dll's produce a different result than if you compile source. I think they are using a very old version of Newtonsoft.Json library which may have been broken in the latest source code...

I'm having the same experience as optimator ("Failed to locate node", CB 1.8 on CentOS, .net lib 1.1.6). My config is:

 <couchbase>
    <servers bucket="default" bucketPassword="">
      <add uri="http://192.168.202.163:8091/pools"  />
    </servers>
  </couchbase>

I can browse to the resource in a browser from the client host. Running tcpdump on the CB server is silent, telling me that the .net client lib isn't sending one packet to the server (though I see traffic of course when navigating with the browser). Firewalls are disabled on both client and server hosts.

Browsing the source of the client lib, it appears that a node for the given key can't be identified in the server pool. I can't successfully build or debug the lib, though, so the trail goes cold.

Any help would be appreciated.

Update: I can build/debug the client lib now, enough to see that my pool is initialized with a NotFoundLocator, which does what it says :-)
Adding a locator line in my couchbase section seemed promising:

<couchbase>
    <locator type="Enyim.Caching.Memcached.DefaultNodeLocator, Enyim.Caching" />
    ...
 
... or 
<couchbase>
    <locator type="Enyim.Caching.Memcached.KetamaNodeLocator, Enyim.Caching" />

... but in the end has no effect; the NotFoundLocator is still configured.

Thanks in advance for any help.

The NotFoundLocator is generally the result of the client's not being able to get the config information from the cluster (i.e., the handshake starting with http://192.168.202.163:8091/pools fails). Your config looks right and you shouldn't need to change the locator element.

Logging should reveal some more details -http://www.couchbase.com/docs/couchbase-sdk-net-1.1/couchbase-sdk-net-lo...

It's hard to step through the code to see where NotFoundLocator is set because that happens on its own thread... Logging should reveal the problem.

Issue resolved. System.Net.WebClient needed 11 seconds to download the pools URI, but had a 10-second timeout. Adding this fixed it:

 <couchbase>
    ...
    <socketPool connectionTimeout="00:01:00" deadTimeout="00:01:00" />
  </couchbase>

I'm not sure why WebClient is so slow, the resource loads instantly in a browser.

Thanks for your help.

Thanks for sharing your solution. I've created an issue at http://www.couchbase.com/issues/browse/NCBC-133 to separate those two timeout values. The WebClient will almost always be slower, though 11 seconds seems to be slower than expected.

My problem was indeed a configuration issue.
This is the working web.config:

<couchbase>
    <servers bucket="mybuckey" bucketPassword="mypass">
      <add uri="http://127.0.0.1:8091/pools/"/>
    </servers>
  </couchbase>

My error is I somehow had this line:

<add uri="http://127.0.0.1:8091/pools/worker"/>       <!--This is bad. Do not use-->

I am trying to store keys in couchbase on windows, bt i am not able to save all keys.
Its not storing more 250 keys at a time.
here is my web.config file

Hi Sarita,

Could you post the code that is leading to the failures? Your config looks fine.

-- John