Search code examples
sftpbiztalkwinscpwinscp-netbiztalk-2016

How to fix WinSCP error 'System.Xml.XmlException: Root element is missing' on SFTP Port


I'm getting the following error on our BizTalk 2016 instance with a SFTP receive port when it polls to connect to a SFTP site:

The Messaging Engine failed to add a receive location "OURPORTNAME" with URL "sftp://oursourceserver:22/Live/Pickup/Exports/." to the adapter "SFTP". Reason: "WinSCP.SessionLocalException: Error parsing session log file ---> System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at WinSCP.SessionLogReader.DoRead()

Looking at the WinSCP site, it looks like the version of WinSCP that is tied to this version of BizTalk can have this error.

The version of WinSCP that comes with BT2016 is:

File Version: 1.5.4.8265 Product Version: 5.13.1.0

I tried copying into the BizTalk install folder a new version 5.13.6 (1.5.6.9061) of the WinSCP assembly and EXE and used the following instructions to update the Biztalk 32 and 64bit configuration files (BTSNTSvc.exe.config) to redirect to this new version of WinSCP:

Microsoft BizTalk SFTP Adapter

(See 'Use a newer WinSCP version')

So in both 64bit and 32bit configs I have:

<bindingRedirect oldVersion="1.5.4.8265" newVersion="1.5.6.9061" />

Having edited that and restarted the host instances, I am getting this from the SFTP port in the event log:

The Messaging Engine failed to add a receive location "OURPORTNAME" with URL "sftp://oursourceserver:22/Live/Pickup/Exports/." to the adapter "SFTP". Reason: "WinSCP.SessionRemoteException: Network error: Software caused connection abort at WinSCP.SessionLogReader.Read(LogReadFlags flags) at WinSCP.ElementLogReader.Read(LogReadFlags flags) at

Any ideas on what could be causing this?


Solution

  • It turned out that after the upgrade there were firewall/connectivity problems that prevented it working on our test environment.