My company uses Rebex SFTP to ftp files which is working great from an ftp perspective, however, when called from a WebMethod the service never returns. Below is how our process flow is working.
- WebMethod is invoked by some other system
- WebMethod calls another class in the same project that queries the database for a list of files to be ftp-ed.
- This class calls an FTP.cs that uses sftp to copy the file (via DownloadFile)
- All files successfully ftp from and to the desired locations, however, the web method never returns and eventually times out.
The web service is supposed to return a string. If I put a break point on the return the breakpoint gets hit with all of the values I am expecting, however, the caller never gets the string from the response.
I am not sure if I am doing something wrong, or if the Rebex.SFTP class was never intended to be invoked from a web method but any advice would be great. Thanks!
Here is my code setup:
public class FTP
{
private Sftp _sftp;
...
public string DownloadFile(string fileName, string ext) {
...
if (_sftp.GetFile(fileName, myNewPath) <= 0)
{
//failed
}
else
{
//success
}
}
}