Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

Unable to store data via .Net Client

19 replies [Last post]
  • Login or register to post comments
Sun, 08/19/2012 - 16:08
harigutta
Offline
Joined: 08/19/2012
Groups: None

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?

Top
  • Login or register to post comments
Wed, 08/22/2012 - 00:09
ingenthr
Offline
Joined: 03/16/2010
Groups:

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.

Top
  • Login or register to post comments
Mon, 09/03/2012 - 08:32
Kraftwurm
Offline
Joined: 09/03/2012
Groups: None

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...

Top
  • Login or register to post comments
Wed, 09/05/2012 - 08:32
ingenthr
Offline
Joined: 03/16/2010
Groups:

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.

Top
  • Login or register to post comments
Wed, 09/05/2012 - 08:47
Kraftwurm
Offline
Joined: 09/03/2012
Groups: None

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!)

Top
  • Login or register to post comments
Thu, 09/06/2012 - 06:17
SkeLLLa
Offline
Joined: 06/22/2012
Groups: None

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.

Top
  • Login or register to post comments
Wed, 09/12/2012 - 07:33
Kraftwurm
Offline
Joined: 09/03/2012
Groups: None

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 !!

Top
  • Login or register to post comments
Thu, 09/13/2012 - 07:18
Kraftwurm
Offline
Joined: 09/03/2012
Groups: None

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

Top
  • Login or register to post comments
Fri, 09/28/2012 - 12:44
john
Offline
Joined: 01/05/2012
Groups: None

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

Top
  • Login or register to post comments
Mon, 10/01/2012 - 13:13
optimator
Offline
Joined: 10/01/2012
Groups: None

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.

Top
  • Login or register to post comments
Mon, 10/01/2012 - 13:15
john
Offline
Joined: 01/05/2012
Groups: None

Could you post your config and code?

Top
  • Login or register to post comments
Tue, 10/02/2012 - 09:27
ezrover
Offline
Joined: 09/19/2012
Groups: None

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...

Top
  • Login or register to post comments
Tue, 10/02/2012 - 09:45
erikmack
Offline
Joined: 10/02/2012
Groups: None

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.

Top
  • Login or register to post comments
Tue, 10/02/2012 - 12:41
erikmack
Offline
Joined: 10/02/2012
Groups: None

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.

Top
  • Login or register to post comments
Tue, 10/02/2012 - 13:46
john
Offline
Joined: 01/05/2012
Groups: None

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.

Top
  • Login or register to post comments
Tue, 10/02/2012 - 14:36
erikmack
Offline
Joined: 10/02/2012
Groups: None

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.

Top
  • Login or register to post comments
Tue, 10/02/2012 - 14:41
john
Offline
Joined: 01/05/2012
Groups: None

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.

Top
  • Login or register to post comments
Wed, 10/03/2012 - 13:05
optimator
Offline
Joined: 10/01/2012
Groups: None

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-->

Top
  • Login or register to post comments
Tue, 10/09/2012 - 00:41
sarita.motan
Offline
Joined: 10/09/2012
Groups: None

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

<configuration>  <configSections>    <section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>  </configSections>  <couchbase>     <servers bucket="dataengine" bucketPassword="">      <add uri="http://xxx.xx.xx.x:8091/pools"/>      <add uri="http://xxx.xx.xx.x:8091/pools"/>    </servers>   </couchbase>    <system.web>    <customErrors mode="RemoteOnly" defaultRedirect="Error.htm"/>    <compilation debug="true" targetFramework="4.0"/>    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>  </system.web></configuration> 

 

 

Top
  • Login or register to post comments
Fri, 10/12/2012 - 08:28
john
Offline
Joined: 01/05/2012
Groups: None

Hi Sarita,

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

-- John

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker