DocumentDB Connectivity Issue

0

Environment

  1. DocumentDB 4.0.0, TLS Enabled
  2. Connecting via .NET Framework 5.0, C# from Visual Studio 2019 from Windows EC2 Instance
  3. Both EC2 and DocumentdB on same VPC
  4. DocumentDB has the Inbound rule configured for Port 27017, for Security GroupID of EC2 Instance

Scenario 1 : Without TLS mongodb://<UserName>:<Password>@<Regional Cluster>:27017/<dbName>?replicaSet=rs0&readpreference=secondaryPreferred&connect=replicaSet Exception : A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/<Document Db Regional Cluster >" }", EndPoint: "Unspecified/<Document Db Regional Cluster >", ReasonChanged: "ServerInitialDescription", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", LastHeartbeatTimestamp: null, LastUpdateTimestamp: "2023-09-02T17:53:37.6366624Z" }] }.

Scenario 2 : With TLS mongodb://<UserName>:<Password>@<Regional Cluster>:27017/<dbName>?tls=true&replicaSet=rs0&readpreference=secondaryPreferred&tlsCAFile=global-bundle.pem Exception: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/<Document Db Regional Cluster >" }", EndPoint: "Unspecified/<Document Db Regional Cluster >", ReasonChanged: "Heartbeat", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: PartialChain at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception) at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm) at System.Net.Security.SslStream.ProcessAuthentication(Boolean isAsync, Boolean isApm, CancellationToken cancellationToken) at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions) at MongoDB.Driver.Core.Connections.SslStreamFactory.CreateStream(EndPoint endPoint, CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken) --- End of inner exception stack trace --- at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.BinaryConnection.Open(CancellationToken cancellationToken) at MongoDB.Driver.Core.Servers.ServerMonitor.InitializeConnection(CancellationToken cancellationToken) at MongoDB.Driver.Core.Servers.ServerMonitor.Heartbeat(CancellationToken cancellationToken)", LastHeartbeatTimestamp: "2023-09-02T18:03:42.4057744Z", LastUpdateTimestamp: "2023-09-02T18:03:42.4057746Z" }] }..

rajaws
gefragt vor 8 Monaten91 Aufrufe
Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen