Bucket with name "Test" does not exist or cannot be reached

Hi,

I am using couchbase version 7.0.2 and .NET SDK version 3.2.5.
We have both web applications and windows service applications hosted in the same server(windows server) and couchbase is hosted in Linux servers.
I am able to connect to the couchbase from windows service applications(WCF services) but not able to connect from Web Applications(ASp.net MVC and Webforms)

Error i am getting in Web Applications :
XTP.Data.FetchCache.CouchbaseCache.BucketInstance - Task Exception : {“Context”:null,“Message”:“Bucket with name Test does not exist or cannot be reached.”,“Data”:{},“InnerException”:null,“StackTrace”:" at Couchbase.Core.ClusterContext.d__56.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Couchbase.Cluster.<>c__DisplayClass29_0.<b__0>d.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at XTP.Data.FetchCache.CouchbaseCache.<>c.<<get_BucketInstance>b__4_0>d.MoveNext()",“HelpLink”:null,“Source”:“Couchbase.NetClient”,“HResult”:-2146233088}

Do we need to enable any Ports or run services in couchbase hosted server(Linux server)?

Thank You

There are certainly a lot of ports that should be open on your Linux Couchbase Servers. However, if it’s working from the same client machine in a different application then it would seem those are correctly configured, at least server-side. The only explanation I have is that there is some configuration difference between the two apps or your Windows Firewall is blocking some outgoing traffic for some reason.

Thanks for the reply

I created one sample web application and hosted in the same server. From the sample web application i am able to connect to couchbase but with the existing web applications it not working.
Both the application configs are same.

For Cluster Connect :
Task task = Task.Run(async () =>
{
try
{
_instance = await Cluster.ConnectAsync(url, userName, password);
}
catch (Exception ex)
{

                                    }
                                });
                                task.Wait();

For Bucket Connect :

Task task = Task.Run(async () =>
{
try
{
_bucketInstance = await _instance.BucketAsync(“Test”);

                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                });
                                task.Wait();

Can u please provide more information to troubleshoot this issue.

Thank you

My best guess would be the way you’re handling tasks and async causing deadlocks or something similar. Generally speaking, using Task.Wait() or Task.Result or Task.GetAwaiter().GetResult() are antipatterns except in very specific circumstances. It must be done very carefully to avoid problems. I can’t say more without understanding the problem, symptoms, and environment a lot better.