Biztalk 2010 Receive location intermittently stops reading files from FTP server.

Recently had a very interesting case. The biztalk 2010 FTP adapter would read messages but if there is a gap of 10-15min where the Server did not have files to give to the Biztalk FTP Receive Location, the Biztalk Service would report Error 500 - Failed to connect to FTP Server.

A network monitor trace basically showed that Biztalk was trying to connect to the FTP server using the old session information. But the server had already decided to discard the old session and did so without notifying the Biztalk Server. As an easy workaround we executed the QUIT command in the After Put Property of the FTP Receive Location. Though not the most efficient method but did the job.