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<TCommandResult>.ProcessReply(ConnectionId connectionId, ReplyMessage<RawBsonDocument> 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<TCommandResult>.ProcessReply(ConnectionId connectionId, ReplyMessage<RawBsonDocument> reply)
MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol<TCommandResult>.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<TDocument>.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)
MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync<TResult>(IReadBinding binding, IReadOperation<TResult> operation, CancellationToken cancellationToken)
MongoDB.Driver.MongoCollectionImpl<TDocument>.ExecuteReadOperationAsync<TResult>(IClientSessionHandle session, IReadOperation<TResult> operation, ReadPreference readPreference, CancellationToken cancellationToken)
MongoDB.Driver.MongoCollectionImpl<TDocument>.UsingImplicitSessionAsync<TResult>(Func<IClientSessionHandle, Task<TResult>> funcAsync, CancellationToken cancellationToken)
Babelfish.ME.MongoDb.Data.Services.AbstractDataService<TEntity>.FindAsync(BsonDocument filter, BsonDocument sort, int skip, int limit) in AbstractDataService.cs
I使用
MongoClientSettings
显然,您将用自己的值替换配置零件。
我唯一能看到的区别是,您没有指定
ReplicaSetName
MongoCredential.CreateCredential
返回的身份验证类型是Scram-SHA-256类型,而您的您是Scram-SHA-1
在我的情况下,Imongocollection没有获得数据库名称。因此,我从Mongoclient手动添加了它,对我有用。 thanks谢谢你。该问题在全球解决了。由于成本,我们公司决定使用自己的MongoDB服务器,而不是Azure Cosmos。以下代码可以与自己的服务器一起使用。一开始我使用Scram-SHA-1。
var configurationSection = _configuration.GetSection("MongoDb");
MongoUrl mongoUrl = new MongoUrl(configurationSection["connectionString"]);
var connectionString = configurationSection["connectionString"];
var mongoClient = new MongoClient(connectionString);