I have an interesting situation. I have a console app with .net framework 4.6.1 connects successfully to Couchbase server 7.0 using .net sdk 3.2.
However, it is unable to connect when used in an Asp.net MVC project with .net framework 4.6.1. The code & dev environment is same.
Is there anyway that we can figure out what’s going on with the connection?
private static async Task InitializeCouchbase()
{
IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddLogging(builder => builder
.AddFilter(level => level >= LogLevel.Debug));
loggerFactory = serviceCollection.BuildServiceProvider().GetService<ILoggerFactory>();
loggerFactory.AddFile("c:/Logs/TWSCouchbaseHelper-{Date}.txt", LogLevel.Debug);
var ipAddressList = new List<string> { "10.254.193.240", "10.254.193.241" };
var config = new ClusterOptions()
.WithConnectionString(string.Concat("http://", string.Join(", ", ipAddressList)))
.WithCredentials("twsuser", "twsusercouchbase")
.WithBuckets("default")
.WithLogging(loggerFactory); //<= Need to add the ILoggerFactory via DI
config.KvConnectTimeout = TimeSpan.FromMilliseconds(12000);
var cluster = await Cluster.ConnectAsync(config);
CBCluster = cluster;
DefaultBucket = await cluster.BucketAsync("default");
BucketManager = cluster.Buckets;
var defaultScope = await DefaultBucket.ScopeAsync("_default");
DefaultCollection = await defaultScope.CollectionAsync("_default");
}