I’m running couchbase locally on docker. I can connect to web ui fine on http://localhost:8091/. I cannot connect from the SDK. My project is .NET core 3.1 Couchbasenetclient 2.7.16. I also tried downgrading the nuget package as low as 2.5.
I have tried every combination of http://localhost:8091 as well as 127.0.0.1:8091 and /pools. It will not connect. Originally i was trying .openBucket with the SASLPASSWORD. But now i am just using the following code to try and connect to the cluster. The user i created when i set up the cluster is “administrator” but i also created an “admin” user from the security tab and have tried connecting with both credentials.
var cluster = new Cluster(new ClientConfiguration
{
Servers = new List<Uri> { new Uri(" http://localhost:8091") }
});
cluster.Authenticate("administrator", "administrator");
var manager = cluster.CreateManager();
var userResult = manager.GetUser(AuthenticationDomain.Local, "admin");
var user = userResult.Value;
Console.WriteLine(user.Name);
Console.WriteLine(user.Domain);
Console.WriteLine(user.Roles);
cluster.Dispose();
The error seems actually related to javascript parsing??
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type ‘Couchbase.Configuration.Server.Serialization.Settings’ because the type requires a JSON object (e.g. {“name”:“value”}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {“name”:“value”}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path ‘settings’, line 1, position 102.
Callstack:
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at Couchbase.Configuration.Server.Providers.Streaming.HttpServerConfig.DownLoadConfig[T](Uri uri)
at Couchbase.Configuration.Server.Providers.Streaming.HttpServerConfig.DownloadConfigs(Uri server)
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func
2 predicate)
at Couchbase.Configuration.Server.Providers.Streaming.HttpServerConfig.Initialize()
at Couchbase.Cluster.CreateManager(String username, String password)
at Couchbase.Cluster.CreateManager()
at CouchTest.Program.Main(String args) in D:\projects\CouchTest\CouchTest\Program.cs:line 21
I get this same error regardless of how i modify the code to try and connect. Any help appreciated