Cant Authenticate Localhost with .NET SDK in .NET Core 3.1

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



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.

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


I run locally on Docker all the time. What ports are you mapping to localhost? It requires more than just 8091, Couchbase Server uses different ports for different services. For a basic app (no SSL, etc) I map 8091-8096 and 11210.

I didn’t map any ports manually i just took the defaults. Hostname is “” and the other ports showing are

ports: {

  • direct: 11210,
  • httpsCAPI: 18092,
  • httpsMgmt: 18091,
  • distTCP: 21100,
  • distTLS: 21150

All of the examples i’ve seen show connecting the sdk to 8091 including

For there record, I can connect to our actual hosted couchbase instances from the sdk, i just can’t connect to my local instance from the sdk. The local web ui works for me.

Perhaps there is a firewall blocking ports somewhere?

Any time you’re having connectivity issues, it’d be good to diagnostically check for lower level details with SDK doctor. It may not find anything, but it will validate that common connectivity problems aren’t there.

You’ll find pre-built binaries on the release page.

Usually the summary at the end is pretty easy to interpret. If you need help with interpretation, please feel free to post it or a link to it here.

@jasongerstorff I think your issue is that you need connectivity from the SDK to the Couchbase Server on more than just port 8091. That port is used for initial bootstrapping and the management API, but after that the SDK connects to other ports (including for authentication).

Try launching your Docker image like this:

docker run -p 8091-8096:8091-8096 -p 11210:11210 couchbase/server:enterprise-6.5.0

As mentioned before, there are more ports you could map for some other features, but this baseline gets you what most people normally need. Also, you can easily change the version tag on the image, of course, I just wrote this example using the latest enterprise release.

And, as mentioned by Matt, if this doesn’t work I’d try running the SDK doctor. However, make sure you don’t run it using Docker. To properly verify behaviors, it needs to be running from the same environment you’re trying to connect from. So I’d run it directly in your OS environment.

That is the docker command I ran, i tried connecting to different 809* ports, it didn’t work. If i use 11210 the CreateManager() method won’t fail like it does with the 809* ports…it seems it authenticated, but then it won’t pull back any users. And I still can’t open a bucket after that with or without the sasl pass as a parameter. I’ve tried using the top level administrator account to authenticate, as well as a couple of users i set up.

I’ll try the SDK doctor and post back.

It says invalid bucket name/password. But that is 100% the correct bucket name. I tried using the credentials as well.

>sdk-doctor diagnose couchbase://

Note: Diagnostics can only provide accurate results when your cluster
is in a stable state. Active rebalancing and other cluster configuration
changes can cause the output of the doctor to be inconsistent or in the
worst cases, completely incorrect.

10:41:43.879 INFO :arrow_forward: Parsing connection string couchbase://
10:41:43.882 INFO :arrow_forward: Connection string identifies the following CCCP endpoints:
10:41:43.882 INFO :arrow_forward: 1.
10:41:43.883 INFO :arrow_forward: Connection string identifies the following HTTP endpoints:
10:41:43.883 INFO :arrow_forward: 1.
10:41:43.884 INFO :arrow_forward: Connection string specifies bucket tms_messaging
10:41:43.885 WARN :arrow_forward: Your connection string specifies only a single host. You should consider adding additional static nodes from your cluster to this list to improve your applications fault-tolerance
10:41:43.885 INFO :arrow_forward: Performing DNS lookup for host
10:41:43.886 INFO :arrow_forward: Attempting to connect to cluster via CCCP
10:41:43.887 INFO :arrow_forward: Attempting to fetch config via cccp from
10:41:43.895 ERRO :arrow_forward: Failed to fetch configuration via cccp from (error: invalid bucket name/password)
10:41:43.895 INFO :arrow_forward: Attempting to connect to cluster via HTTP (Terse)
10:41:43.895 INFO :arrow_forward: Attempting to fetch terse config via http from
10:41:43.900 ERRO :arrow_forward: Failed to fetch terse configuration via http from (error: http error (status code: 404))
10:41:43.900 INFO :arrow_forward: Attempting to connect to cluster via HTTP (Full)
10:41:43.901 INFO :arrow_forward: Failed to connect via HTTP (Full), as it is not yet supported by the doctor
10:41:43.902 INFO :arrow_forward: Selected the following network type:
10:41:43.903 ERRO :arrow_forward: All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible
10:41:43.903 INFO :arrow_forward: Diagnostics completed

e[33m[WARN]e[0m Your connection string specifies only a single host. You should consider adding additional static nodes from your cluster to this list to improve your applications fault-tolerance
e[31m[ERRO]e[0m Failed to fetch configuration via cccp from (error: invalid bucket name/password)
e[31m[ERRO]e[0m Failed to fetch terse configuration via http from (error: http error (status code: 404))
e[31m[ERRO]e[0m All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible

Found multiple issues, see listing above.

Hello jasongerstorff,

  1. Do you use 1-node or 3-node docker image variant?
  2. The probliem is reproduced with quick-install example? (

I actually used the command on docker hub, its the same port mapping, it does use a -d option not the -t i don’t know if that matters.

I’m not entirely sure what image variant I’m using, the image is 5008c. There is only one node running under servers. Again, i can access the web console just fine when the container is running, i just cannot connect from the sdk.

I tried multiple versions of the .NET sdk including the 3.0 beta.

I’m pretty sure if you see this, there would be more information in the memcached.log on the cluster side.

This one doesn’t make much sense (unless it’s a bug in sdk-doctor?). If you’re getting the UI at that same ip/host, then the terse URL must be there. Maybe you can try a quick curl to that URI and see if the headers indicate it’s Couchbase Server. For example with my server:

$ curl -i -u ingenthr http://ingenthr@centos7-2:8091/poo
Enter host password for user 'ingenthr':
HTTP/1.1 200 OK
X-XSS-Protection: 1; mode=block
X-Permitted-Cross-Domain-Policies: none
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Server: Couchbase Server
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Date: Fri, 03 Apr 2020 03:08:36 GMT
Content-Type: application/json
Content-Length: 4538
Cache-Control: no-cache,no-store,must-revalidate