Hi,
I m facing with an exception when I try to open the bucket. This is an ASP project.
The code is realy simple
private static bool IsInitialized;
private static string BucketName;
private static void Initialize()
{
if (IsInitialized)
return;
// Build the configuration for the bucket
var configuration = new ClientConfiguration();
//Clear default values
configuration.BucketConfigs.Clear();
configuration.Servers.Clear();
//Bucket config
BucketName = RoleEnvironment.GetConfigurationSettingValue("CouchbaseBucket");
var bucketConfig = new BucketConfiguration
{
BucketName = BucketName,
Password = RoleEnvironment.GetConfigurationSettingValue("CouchbaseBucketPassword"),
UseSsl = false,
PoolConfiguration = new PoolConfiguration {
MinSize = 1,
MaxSize = 20
}
};
configuration.BucketConfigs.Add(
bucketConfig.BucketName,
bucketConfig
);
//Add servers from config
var servers = RoleEnvironment.GetConfigurationSettingValue("CouchbaseServers").Split(',');
foreach (var server in servers)
{
var uri = new System.Uri("http://" + server + ":8091/pools");
configuration.Servers.Add(uri);
}
ClusterHelper.Initialize(configuration);
IsInitialized = true;
}
public static IBucket GetBucket()
{
if (!CouchbaseManager.IsInitialized)
Initialize();
return ClusterHelper.GetBucket(BucketName);
}
The error occurs at line
return ClusterHelper.GetBucket(BucketName);
The exception details are
System.AggregateException was unhandled by user code
HResult=-2146233088
Message=Could not bootstrap - check inner exceptions for details.
Source=Couchbase.NetClient
StackTrace:
in Couchbase.Core.ClusterController.CreateBucket(String bucketName, String password)
in CouchBaseRepository`1.OpenBucket() in CouchBaseRepository.cs:ligne 32
…
in SyncInvokeAcceptIpTracking(Object , Object , Object )
in System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object inputs, Object& outputs)
in System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
InnerException: System.AggregateException
HResult=-2146233088
Message=One or many errors occurs
Source=Couchbase.NetClient
StackTrace:
in Couchbase.Configuration.Server.Providers.CarrierPublication.CarrierPublicationProvider.GetConfig(String bucketName, String password)
in Couchbase.Core.ClusterController.CreateBucket(String bucketName, String password)
InnerException: System.NullReferenceException
HResult=-2147467261
Message=Object reference not set to an instance of an object
Source=Couchbase.NetClient
StackTrace:
in Couchbase.Configuration.Server.Providers.CarrierPublication.CarrierPublicationProvider.GetConfig(String bucketName, String password)
Someone has an idea why I get this error ?