Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-3172

Getting "Authentication failed because the remote party has closed the transport stream" while connection mongodb V4.0 using C# driver.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Configuration, Connectivity
    • None
    • Environment:
      Production

      We are trying to implement SSL authentication with the MongoDB 4.0 version using the below connection string and facing authentication issues.

       mongodb://username:password@hostname:27017/?authSource=admin&readPreference=primary&ssl=true&sslPEMKeyFile=C:/etc/ssl/client.pem"

      At MongoDB log, we see the application connections are closing immediately with error message :

      encountered a network error during SourceMessage: SocketException: no shared cipher

      application log: 
      2020-02-20 12:39:53 [Debug] Failed to authenticate HTTPS connection.
      Properties: { EventId:

      { Id: 1 }

      , SourceContext: "Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware", ConnectionId: "0HLTM5FID0INL", Application: "DCDService" }
      MachineName: NB1999-01924579
      System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
         at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
         at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)
         at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
         at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__69_0(SslServerAuthenticationOptions arg1, CancellationToken arg2, AsyncCallback callback, Object state)
         at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
         at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
         at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state)
         at System.Net.Security.SslStream.AuthenticateAsServerAsync(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.InnerOnConnectionAsync(ConnectionContext context)
       
       
       
       

            Assignee:
            Unassigned Unassigned
            Reporter:
            developer.avisha@gmail.com Bhaskar Avisha
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: