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

Failed to connect to Node

5 replies [Last post]
  • Login or register to post comments
Tue, 12/11/2012 - 11:40
Vishal Batghare
Offline
Joined: 12/11/2012
Groups: None

I have installed Couchbse 2.0 server on my local box and .net driver 1.2.

Every time I try to connect to server and save the object (from same box) it gives "Failed to connect to server".

I read this thread (http://www.couchbase.com/forums/thread/unable-store-data-net-client) and tried everything whatever mentioned in it it does not work.

I tried uninstalling server copule of times and restarting the box, no luck.

I have specifically opened port 8091 for all traffics, that did not help either.

Please help.

Regards,
VB

Top
  • Login or register to post comments
Wed, 12/12/2012 - 02:21
daschl
Offline
Joined: 05/19/2012
Groups: None

Hi,

can you please post the snippet where you are connecting to the server?

Top
  • Login or register to post comments
Wed, 12/12/2012 - 10:15
Vishal Batghare
Offline
Joined: 12/11/2012
Groups: None

I have this web.config section to read my couchbase connection properties in my custom class

  <CacheConfig>

    <CacheConfigElement StoreType="Couchbase" ConnectionString="http://localhost:8091/pools/" BucketName="default" BucketPassword="Administrator" >

      <TypeElementCollection>

        <TypeElement Name="Rms.Platform.Cache2.Test.Contract"/>

        <TypeElement Name="Rms.Platform.Cache2.Test.Portfolio"/>

      </TypeElementCollection>

    </CacheConfigElement>

    <!--<CacheConfigElement StoreType="Couchbase" ConnectionString="http://localhost:8091/pools/" BucketName="BucketName1" BucketPassword="Administrator" >

      <TypeElementCollection>

        <TypeElement Name="Rms.Platform.Cache2.Test.Contract1"/>

        <TypeElement Name="Rms.Platform.Cache2.Test.Contract11"/>

      </TypeElementCollection>

    </CacheConfigElement>-->

The in this code I am trying to create connection 

  var config = new CouchbaseClientConfiguration

            {

                Bucket = CouchConfig.BucketName,

                BucketPassword = CouchConfig.BucketPassword

            };

            config.Urls.Add(new Uri(CouchConfig.ConnectionString));

            config.SocketPool.ConnectionTimeout = new TimeSpan(0, 0, 1, 0, 0);

            config.SocketPool.DeadTimeout = config.SocketPool.ConnectionTimeout;

And this the save method.

       public bool SaveObject<T>(string key, T singleObject) where T : class

        {

            if (Logger.IsDebugEnabled) { Logger.LogDebug("Start SaveObject"); }

 

            try

            {

                ValidateKeys(new List<string> { key });

                if (singleObject == null)

                {

                    if (Logger.IsErrorEnabled) { Logger.LogError("Cache object is null."); }

                    throw new ArgumentException("Cache object is null.");

                }

 

                var result = CouchbaseClient.ExecuteStore(StoreMode.Set, key, singleObject);

                if (result.Success)

                {

                    return true;

                }

                

                if (result.Exception == null && !string.IsNullOrWhiteSpace(result.Message))

                {

                    throw new Exception(result.Message);

                }

 

                throw result.Exception;

            }

            catch (Exception ex)

            {

                if (Logger.IsErrorEnabled) { Logger.LogError("Exception in SaveObject", ex); }

                throw;

            }

            finally

            {

                if (Logger.IsDebugEnabled) { Logger.LogDebug("End SaveObject"); }

            }

 

 

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

Hi Vishal,

It looks like you're using the default bucket in your app, but passing a bucket password to the client. Could you remove the BucketPassword line or set it to an empty string and try again? The "default" bucket in auth-less bucket.

-- jz

Top
  • Login or register to post comments
Wed, 12/12/2012 - 11:11
Vishal Batghare
Offline
Joined: 12/11/2012
Groups: None

 Even that was tried, it does not work

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

You can get detailed logs about any possible exceptions by setting up logging - http://www.couchbase.com/docs/couchbase-sdk-net-1.2/couchbase-sdk-net-lo.... The default bucket definitely won't work with a password, so make sure you do remove that. Even if that's not the underlying cause, it will cause problems.

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