biztalk cluster sso

SFTP Adapter is not able to delete files on SFT Server after picking them

SFTP Adapter is not able to delete files on SFT Server after picking them up

Issue 1

Error: The adapter “SFTP” raised an error message. Details “System.Exception: Message: Open remote file for read error.. Sftp Error Code: ‘3221488178’. Sftp Error message: ‘The system cannot find the file specified.

Symptom 1

The adapter is able to download all files contained in the observed SFTP folder and to put them into the BizTalk MessageBox. But the files are not deleted on the SFTP server. Instead, we can see the following two warnings for each downloaded message in the Application eventlog on the BizTalk machine: The adapter “SFTP” raised an error message. Details “System.Exception: Message: Open remote file for read error.. Sftp Error Code: ‘3221488178’. Sftp Error message: ‘The system cannot find the file specified.

Another observed issue occurs if the SFTP folder observed by the SFTP Adapter contains only one file. In this case, the file will not be downloaded by the SFTP adapter and will not be inserted to the BizTalk MessageBox. Instead, in the application eventlog on the BizTalk server we can see the following warning occurring each time the adapter tries to download the file contained in the SFTP folder:
Source: BizTalk Server, Event ID: 5740, Level: Warning

The adapter “SFTP” raised an error message. Details “System.Exception: Message: Open remote file for read error.. Sftp Error Code: ‘3221488178’. Sftp Error message: ‘The system cannot find the file specified.

Issue 2

You would be able to send file to a SFTP location but not able to receive the file from SFTP location.

Symptom 2

The BizTalk SFTP adapter will not able to pick the file from SFTP location. There might not be any warnings or errors reported in event viewer.

Troubleshooting

SFTP, which stands for SSH File Transfer Protocol, or Secure File Transfer Protocol, is a separate protocol packaged with SSH that works in a similar way over a secure connection.

This topic lists the supported SFTP servers by BizTalk Server 2013 and newer versions. If an SFTP server is not listed, it may still work. This list contains the SFTP servers the product group tested.
Supported Servers

Server Version
freeSSHD (WeOnlyDo)
IBM Secure Gateway Maverick
OpenSSH 6.x (generic)
Oracle Linux
SUSE Linux
Serv-U
Titan srtSSHServer_10.00
Ubuntu Linux
VanDyke VShell Secure Shell Server
3.x
4.x
WS FTP
WindSFTP 

If your SFTP Server is not among the list of supported servers listed above, then this is a known issue.
It is by design, the underlying open source library used by the current SFTP adapter is not able to handle the SFTP servers outside of what is listed above and it would not work as expected.

Solution

The Microsoft Product Group has confirmed that this is a known limitation with the SFTP Adapter pack. This will be fixed in BizTalk 2016 with a new SFTP adapter and try to backport it in BizTalk 2013 R2.

Workarounds

  1. Use other SFTP server ( Need to move from proFTPD to any other SFTP servers from the list of supported SFTP Servers shared in the link earlier).
  2. Schedule psftp.exe to receive files to a local folder every x minutes and pick up the files locally with file adapter instead.
  3. There is a SFTP adapter written by one of our MVPs called Blogical SFTP adapter. It is free adapter with no additional cost And it keeps BizTalk logic with retries, msgbox etc.

Below are the steps to setup Blogical SFTP adapter:
In order to get the SFTP adapter as mentioned in point 3, please follow the given instructions:
Here is the registry key to have both Blogical SFTP adapter and our SFTP adapter installed at the same time.
———–

  • Install it : http://sftpadapter.codeplex.com/
  • Change this registry value from SFTP to BSFTP to not interfere with BizTalk inbox SFTP adapter (we already have SFTP adapter so need another name):

—-BSFTP.reg start——–
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{B4F8C77D-08C9-4B82-9922-ABB646654DEB}\BizTalk]
“AliasesXML”=”<AdapterAliasList><AdapterAlias>BSFTP://</AdapterAlias></AdapterAliasList>”
—-BSFTP.reg end——–

  • Add adapter in BizTalk admin console with BSFTP prefix (to distinguish between them)
  • Convert key to OpenSSH format (Blogical adapter use this format instead of Putty PPK format. You can convert with PuttyGen tool from Putty.
  • Configure receive location with OpenSSH key
  • Test
  • Then you access our SFTP adapter with sftp:// prefix and blogical with BSFTP:// , it may still show as SFTP:// in some locations, but it is working fine for us with both.

4. Use other 3rd party BizTalk SFTP adapter (paid) like nSoftware, Eldos.