Я пытаюсь установить соединение с 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
MongoDb.Драйвер. Аутентификация через SCRAM-SHA-1 ⇐ C#
Место общения программистов C#
-
Anonymous
1770296940
Anonymous
Я пытаюсь установить соединение с 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
Подробнее здесь: [url]https://stackoverflow.com/questions/57183016/mongodb-driver-authentication-via-scram-sha-1[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия