Я пытаюсь установить соединение с Azure Cosmos DB (MongoDb). Я использую MongoDb.Driver v2.8.1. Может ли кто-нибудь мне помочь? Большое спасибо.
var configurationSection = _configuration.GetSection("MongoDb");
MongoUrl mongoUrl = new MongoUrl(configurationSection["connectionString"]);
var databaseName = configurationSection["databaseName"];
var userName = mongoUrl.Username;
var password = mongoUrl.Password;
MongoClientSettings settings = new MongoClientSettings();
settings.Server = mongoUrl.Server;
settings.UseSsl = true;
settings.SslSettings = new SslSettings();
settings.SslSettings.EnabledSslProtocols = SslProtocols.Tls12;
settings.ConnectTimeout = TimeSpan.FromMinutes(1);
MongoIdentity identity = new MongoInternalIdentity(databaseName, userName);
MongoIdentityEvidence evidence = new PasswordEvidence(password);
settings.Credential = new MongoCredential("SCRAM-SHA-1", identity, evidence);
var mongoClient = new MongoClient(settings);
При попытке получить данные из коллекции возникает следующее исключение:
An unhandled exception occurred while processing the request.
MongoCommandException: Command saslContinue failed: SaslFailed. ConnectionId e6e7c4d7-4dcc-40c5-ad56-3307f3323a1a ActivityId: 9af84117-0000-0000-0000-000000000000.
MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol.ProcessReply(ConnectionId connectionId, ReplyMessage reply)
MongoAuthenticationException: Unable to authenticate using sasl protocol mechanism SCRAM-SHA-1.
MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
Stack Query Cookies Headers
MongoCommandException: Command saslContinue failed: SaslFailed. ConnectionId e6e7c4d7-4dcc-40c5-ad56-3307f3323a1a ActivityId: 9af84117-0000-0000-0000-000000000000.
MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol.ProcessReply(ConnectionId connectionId, ReplyMessage reply)
MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
MongoDB.Driver.Core.Authentication.SaslAuthenticator.AuthenticateAsync(IConnection connection, ConnectionDescription description, CancellationToken cancellationToken)
Show raw exception details
MongoAuthenticationException: Unable to authenticate using sasl protocol mechanism SCRAM-SHA-1.
MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
MongoDB.Driver.Core.Servers.Server.GetChannelAsync(CancellationToken cancellationToken)
MongoDB.Driver.Core.Operations.FindOperation.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)
MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync(IReadBinding binding, IReadOperation operation, CancellationToken cancellationToken)
MongoDB.Driver.MongoCollectionImpl.ExecuteReadOperationAsync(IClientSessionHandle session, IReadOperation operation, ReadPreference readPreference, CancellationToken cancellationToken)
MongoDB.Driver.MongoCollectionImpl.UsingImplicitSessionAsync(Func funcAsync, CancellationToken cancellationToken)
Babelfish.ME.MongoDb.Data.Services.AbstractDataService.FindAsync(BsonDocument filter, BsonDocument sort, int skip, int limit) in AbstractDataService.cs
Подробнее здесь: https://stackoverflow.com/questions/571 ... cram-sha-1