N1QL query not working


I use .NET WEB API for working with couchbase Enterprise Edition 6.0.1.
I use Swagger for my test, and the method GetUser(string id) it is OK, it return a User.
BUT, GetAllUser doest’n work, I have this exception:
Couchbase.Linq.CouchbaseQueryException: ‘An error occurred executing the N1QL query. See the inner exception for details.’
SocketException: A connection attempt failed because the connected party did not respond properly beyond a certain time or an
established connection failed because the connection host did not respond

In the Application_Start(), I put this code
ClusterHelper.Initialize(new ClientConfiguration
Servers = new List { new Uri(http://xx.xxx.xxx.xx:8091/") }
}, new PasswordAuthenticator(“xxxxxx”, “xxxxxx”));

And in the repository:

private readonly IBucket _bucket;
private readonly IBucketContext _context;

public UserRepository(IBucket bucket, IBucketContext context)
_bucket = ClusterHelper.GetBucket(“mybucket”);
_context = new BucketContext(_bucket);

public List GetAllUsers()
return _context.Query()
.OrderBy(p => p.Username)

public User GetUser(string id)
var result = _bucket.Get(id);
if (!result.Success && result.Exception != null)
throw result.Exception;
return result.Value;

Hi @martinsse,

As I mentioned in the blog comments, are you sure that the port(s) is open and available to your client? If you aren’t sure, you can run https://github.com/couchbaselabs/sdk-doctor to check. That sounds like the most likely reason you’re getting this error message.