Open SFTP connection error. RRS feed

  • Question

  • Hi,

    I am trying to send files towards sftp with SFTP adapter in BizTalk 2013 R2, Getting the below error.

    Open SFTP connection error.
    Details:"Microsoft.BizTalk.Adapter.SftpInvoker.SftpException: Open SFTP connection error.

    Server stack trace: 
       at Microsoft.BizTalk.Adapter.SftpInvoker.SftpInvoker.Open()
       at Microsoft.BizTalk.Adapter.Sftp.SftpConnection.OpenUnderlyingConnection(SftpConnectionProperties connectionProperties)
       at Microsoft.BizTalk.Adapters.CommonHelpers.Connection`3.ConnectionPool`3.GetConnection(T1 connectionProperties, TimeSpan timeout)
       at Microsoft.BizTalk.Adapters.CommonHelpers.Connection`3.GetConnection(T connectionProperties, TimeSpan timeout)
       at Microsoft.BizTalk.Adapter.Sftp.SftpOutputChannel.Send(Message message, TimeSpan timeOut)
       at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
       at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

    Exception rethrown at [0]: 
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndSend(IAsyncResult result)

    Exception rethrown at [1]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IOutputChannel.EndSend(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendCallback(IAsyncResult result)".

    Have installed CU1 CU3 and CU6 as well in BizTalk 2013R2. Kindly suggest.

    We are already using SFTP for other applications without any issues. When i am trying to connect this new host i am getting this error.

    I tried to connect with same details via FileZilla, There i don't see any issue.

    THanks in advance


    • Edited by panadi Thursday, August 30, 2018 12:19 PM
    Thursday, August 30, 2018 12:17 PM

All replies

  • This is know issue with BizTalk 2013 R2 . Microsoft already released the fix for this  issue. 



    Chandra Kumar 

    Thursday, August 30, 2018 2:00 PM
  • Hi Panadi,

    Two points i would suggest to follow,

    1) Since this was fixed in CU1, i would recommend you to go back to CU1 ( since the same error reported back in CU5)

    2) Try with simple WinScp client (internally SFTP Adapter uses WinScp library) to connect to the SFTP folder and see if you are able to connect also refer the below Microsoft Tech Net forum (Refer Link#1) suggested settings on SFTP server side which will helpful if you need to connect with SSH.

    Link#1 https://social.technet.microsoft.com/wiki/contents/articles/33638.biztalk-server-2013-r2-sftp-adapter-tricks-and-pitfalls.aspx


    Hope this Helps!!!! Regards, Note: Please Mark As Answered if you satisfy with Reply.

    Friday, August 31, 2018 9:31 AM
  • Similar issue was raised here Initialize error for SFTP adapter in BizTalk 2013 R2 back in 2014.  Unfortunately, also no solution.
    Monday, October 1, 2018 12:55 AM
  • Panadi, can you get them to do some logging at the SFTP server side?  That might give some clues as to where the issue is.
    Tuesday, October 2, 2018 10:36 PM
  • I eventually hit the same issue and blogged about it here 

    Basically the issue is probably the fact the the SFTP server you are trying to connect to is using a Cipher that is not supported by the native BizTalk SFTP adapter.  Microsoft has addressed this in later version of BizTalk by using the WinSCP library.  Workaround for BizTalk 2013 R2 is to use a third party SFTP adapter that does support the Ciphers

    Monday, August 10, 2020 1:55 AM
  • If you capture a network trace you can see the key exchange/cipher hand shake between the SFTP client (BizTalk) and the SFTP server. (see below) BizTalk 2013/2013 R2 is using an sftp code library, while BizTalk 2016/2020 is using WinSCP library. If there is no match between sftp client and the sftp server in handshake you are not able to connect. Workarounds: 
    - Upgrade to BizTalk 2016/2020
    - Change SFTP server to have matching algorithms as the SFTP client
    - Use external script to do the transfer from/to file location, e g scheduled task psftp.exe
    - 3rd party/own SFTP adapter, e g BizTalk community based Blogical SFTP adapter

    BizTalk 2013/2013 R2 network trace handshake: 

    Key Exchange Init

        kex_algorithms string: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

        server_host_key_algorithms string: ssh-rsa,ssh-dss

        encryption_algorithms_client_to_server string: aes256-ctr,aes256-cbc,rijndael-cbc@lysator.liu.se,aes192-ctr,aes192-cbc,aes128-ctr,aes128-cbc

        encryption_algorithms_server_to_client string: aes256-ctr,aes256-cbc,rijndael-cbc@lysator.liu.se,aes192-ctr,aes192-cbc,aes128-ctr,aes128-cbc

        mac_algorithms_client_to_server string: hmac-sha1,hmac-sha1-96,hmac-md5

        mac_algorithms_server_to_client string: hmac-sha1,hmac-sha1-96,hmac-md5

        compression_algorithms_client_to_server string: none,zlib

        compression_algorithms_server_to_client string: none,zlib

    Monday, August 10, 2020 10:36 PM