none
Port number cannot be negative SFTP Send Adapter issue with BizTalk 2016 RRS feed

  • Question

  • Hi, 

    I have solution running in BizTalk 2013 R2 with Dynamic SFTP send port, when I installed the same solution on BizTalk 2016 .I am getting the below error.

    System.ArgumentException: Port number cannot be negative

    Server stack trace:

       at WinSCP.SessionOptions.SetPortNumber(Int32 value)

       at Microsoft.BizTalk.Adapter.Sftp.SftpConnection.GetSessionOptions(SftpConnectionProperties sftpConnectionProperties)

       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)

    If anyone has already faced this issue and if you know the  solution for this issue. Please share with me.

    Thanks,

    Chandra Kumar


    Thursday, August 30, 2018 1:30 PM

Answers

  • This is bug in BizTalk 2016 , I open the case with Microsoft , They did confirm. This is an issue in BizTalk 2016.
    • Marked as answer by Chandra Kumar Wednesday, September 12, 2018 2:28 PM
    Wednesday, September 12, 2018 2:28 PM

All replies

  • Please share the code where the dynamic port is created

    Thanks /Peter


    When asking a question please be as thoroughly as possible this will make it easier to assist you http://www.catb.org/esr/faqs/smart-questions.html

    Thursday, August 30, 2018 2:08 PM
  • Hi Chandra Kumar,

    Since it is dynamic port, you must be setting port values either from look up or hardcoded them some where in the code. can you verify port number is correct? 

    Try to connect to sftp location using WinSCP on the BizTalk box and see if you face same issue. 

    Thanks

    Srini

    Thursday, August 30, 2018 2:19 PM
  • Thanks for your reply Peter, this dynamic port is configured in Orchestration with general SFTP configuration with passing following parameter. Nothing wrong with port because this is working fine in BizTalk 2013 R2.

    Here is the sample code for you 

    msgOut=msgIn;

    msgOut(SFTP.UserName)=msgSftpBre.UserName;

    msgOut(SFTP.Password)=msgSftpBre.Password;

    msgOut(SFTP.AccessAnyServerHostKey)=true;

    DynamicSFTPPort(Microsoft.XLANGs.BaseTypes.Address)=msgSftpBre.Address + "%MessageID%.xml";



    Thursday, August 30, 2018 2:23 PM
  • What value do you have in the variable:

    msgSftpBre.Address


    NB! Please change server name to some not valid values
    eg ftp.somehost.invalid

    /Peter


    Thursday, August 30, 2018 2:37 PM
  • Peter, I am using right value, it’s not like I am trying to learn how to use dynamic port. I have running solution and I am getting this error with BizTalk 2016. Please try to understand the error.

    Thanks for your time. 


    Thursday, August 30, 2018 8:46 PM
  • This is bug in BizTalk 2016 , I open the case with Microsoft , They did confirm. This is an issue in BizTalk 2016.
    • Marked as answer by Chandra Kumar Wednesday, September 12, 2018 2:28 PM
    Wednesday, September 12, 2018 2:28 PM
  • Please try this that should work:
    SFTPDynSendMsg(Microsoft.XLANGs.BaseTypes.Address)= "sftp://127.0.0.1:22//test//" + "%MessageID%.xml";

    instead of without port number:
    SFTPDynSendMsg(Microsoft.XLANGs.BaseTypes.Address)= "sftp://127.0.0.1//test//" + "%MessageID%.xml";

    If you inspect a SFTP send port you can copy the URI, which also includes the port. So try to use similar explicit port included in the address. It is not really documented what it will default to if you forget to specify the port, but in BizTalk 2013/2013R2 if defaulted to 22, so a regression to default to -1 instead. This should be changed in future BizTalk 2016 update to have default port to 22 if not specified. I would recommend to use explicit port number in any case as it is more clear when troubleshooting. 

    Tuesday, February 19, 2019 2:54 PM