FYI, I posted this question earlier and then tried to edit the question with a code sample and additional information. When I tried to update the post, I got an error that said access denied and now it looks like the original has disappeared. Just a disclaimer if the original comes back. Anyway…
I have yet to successfully get any data using CouchbaseClient.Get(…). I have everything installed on my dev laptop and only one instance of the Couchbase server running. I have been working with the sample buckets.
public class CBTest
{
private CouchbaseClient _client;
private CouchbaseClientConfiguration _clientConfig;
public CBTest()
{
_clientConfig = GetCCConfig();
if (_clientConfig == null)
_client = new CouchbaseClient();
else
_client = new CouchbaseClient(_clientConfig);
}
public void Start()
{
var savedBeer = _client.Get("new_holland_brewing_company-sundog");
Console.WriteLine(savedBeer);
bool worked = _client.TryGet("512_brewing_company", out savedBeer);
Console.WriteLine(savedBeer);
}
private CouchbaseClientConfiguration GetCCConfig()
{
_clientConfig = new CouchbaseClientConfiguration();
_clientConfig.Username = "Administrator";
_clientConfig.Bucket = "beer-sample";
_clientConfig.BucketPassword = "<password>";
_clientConfig.Urls.Add(new Uri("http://192.168.52.1:8091/pools"));
return _clientConfig;
//to test settings configured in app.config, comment out the contents of this function out and return null
}
}
_client.Get() always returns null.
Here are the log entries:
2013-11-18 16:23:28,223 [9] DEBUG Couchbase.MessageStreamListener [(null)] <(null)> - Starting the listener. Queue=True
2013-11-18 16:23:28,225 [10] DEBUG Couchbase.MessageStreamListener [(null)] <(null)> - Started working.
2013-11-18 16:23:28,245 [10] DEBUG Couchbase.MessageStreamListener [(null)] <(null)> - Looking for the first working node.
2013-11-18 16:23:28,287 [10] ERROR Couchbase.BucketConfigListener [(null)] <(null)> - Error resolving streaming uri: http://127.0.0.1:8091/pools
System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
at Couchbase.ConfigHelper.DeserializeUri[T](WebClient client, Uri uri, IEnumerable1 converters) at Couchbase.ConfigHelper.GetPoolsConfigUri(WebClient client, Uri clusterUrl) at Couchbase.ConfigHelper.ResolveBucket(WebClient client, Uri bootstrapUri, String name) at Couchbase.BucketConfigListener.ResolveBucketUri(WebClientWithTimeout client, Uri root, String bucketName) 2013-11-18 16:23:28,289 [10] WARN Couchbase.MessageStreamListener [(null)] <(null)> - Could not resolve url http://127.0.0.1:8091/pools; trying the next in the list 2013-11-18 16:23:28,290 [10] WARN Couchbase.MessageStreamListener [(null)] <(null)> - Could not found a working node. 2013-11-18 16:23:28,290 [10] WARN Couchbase.MessageStreamListener [(null)] <(null)> - All nodes are dead, sleeping for a while. 2013-11-18 16:23:28,291 [10] INFO Couchbase.CouchbasePool [(null)] <(null)> - Received new configuration. 2013-11-18 16:23:28,292 [10] INFO Couchbase.CouchbasePool [(null)] <(null)> - Config is empty, all nodes are down. 2013-11-18 16:23:28,293 [10] DEBUG Couchbase.MessageStreamListener [(null)] <(null)> - Processing message: 2013-11-18 16:23:32,558 [9] DEBUG Couchbase.CouchbasePool [(null)] <(null)> - this.state was null, returning null node for key 'new_holland_brewing_company-sundog' 2013-11-18 16:23:37,574 [9] DEBUG Couchbase.CouchbasePool [(null)] <(null)> - this.state was null, returning null node for key '512_brewing_company' 2013-11-18 16:23:41,570 [10] DEBUG Couchbase.MessageStreamListener [(null)] <(null)> - Looking for the first working node. 2013-11-18 16:23:41,583 [10] ERROR Couchbase.BucketConfigListener [(null)] <(null)> - Error resolving streaming uri: http://127.0.0.1:8091/pools System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) at System.Net.WebClient.DownloadString(Uri address) at Couchbase.ConfigHelper.DeserializeUri[T](WebClient client, Uri uri, IEnumerable
1 converters)
at Couchbase.ConfigHelper.GetPoolsConfigUri(WebClient client, Uri clusterUrl)
at Couchbase.ConfigHelper.ResolveBucket(WebClient client, Uri bootstrapUri, String name)
at Couchbase.BucketConfigListener.ResolveBucketUri(WebClientWithTimeout client, Uri root, String bucketName)
2013-11-18 16:23:41,583 [10] WARN Couchbase.MessageStreamListener [(null)] <(null)> - Could not resolve url http://127.0.0.1:8091/pools; trying the next in the list
2013-11-18 16:23:41,583 [10] WARN Couchbase.MessageStreamListener [(null)] <(null)> - Could not found a working node.
2013-11-18 16:23:41,583 [10] WARN Couchbase.MessageStreamListener [(null)] <(null)> - All nodes are dead, sleeping for a while.
2013-11-18 16:23:41,584 [10] INFO Couchbase.CouchbasePool [(null)] <(null)> - Received new configuration.
2013-11-18 16:23:41,584 [10] INFO Couchbase.CouchbasePool [(null)] <(null)> - Config is empty, all nodes are down.
2013-11-18 16:23:41,584 [10] DEBUG Couchbase.MessageStreamListener [(null)] <(null)> - Processing message:
I see the entry Error resolving streaming uri: http://127.0.0.1:8091/pools
System.Net.WebException: The remote server returned an error: (401) Unauthorized.
Not sure what this means, I can paste the url in a browser and it returns a Json document.