BizTalk Sftp Adapter - Troubleshooting

Listen with webReader
Published 05 March 08 04:37 PM | wmmihaa

We’ve used and tested this adapter extensively for my former customer, and when correctly configured, we haven’t had any major issues. However, you might find it challenging to use due to other factors such as generating identity key files, opening of firewalls, installing Sftp servers etc.

The exchange of keys is a particular annoying topic. If you are already familiar to the Sftp protocol, you might not see this as an obstacle, but generally when using BizTalk you’d be given any necessary authentication information, and from there you’d go on and configure your port.
In the scenario of using a Sftp adapter, BizTalk would be the client, and would therefore have the private key (in contrast to ssl, where the host has the private key). The owner of the host system will require a public key from you, to create a user account. When given that account, you’re now able to configure and test your adapter.

This might not seem as a problem, but in my experience it is. The fact that the host system ower (if he or she exists), is often not the person who would do the actual work, which means you’d have yet another (Unix) person to talk to. This will increase the possibility of anything going wrong.

Of cource you may use user name/password as authentication, in case you can disregard all I've said... 

Rather than using BizTalk, you may find it easier to use a console application to make sure the connection is working. You could also use other applications such as Tunnelier, for the same reason, but it might work differently. Below you find a simple sample of what the code could look like. Make sure to reference the Blogical.Shared.Adapters.Sftp assembly:

class Program 
        static void Main(string[] args) 
            string host = System.Configuration.ConfigurationSettings.AppSettings["host"]; 
            string user = System.Configuration.ConfigurationSettings.AppSettings["user"]; 
            string pass = System.Configuration.ConfigurationSettings.AppSettings["pass"]; 
            string keyfile = System.Configuration.ConfigurationSettings.AppSettings["keyfile"]; 

            using (Sftp sftp = new Sftp(host, user, pass, keyfile)) 
                catch (Exception ex) 
                    Console.WriteLine("-=<>=- EXCEPTION"); 

                    int i = 1; 
                    while (ex.InnerException != null) 
                        ex = ex.InnerException; 
                        Console.WriteLine("-=<>=- INNER EXCEPTION " + i++); 

            Console.WriteLine("Test completed. Press Enter to Exit application."); 

Another thing…the UseLoadBalancing property on the receive endpoint is by default set to true. This is going to cause you problems if you haven’t created the database table. Make sure to set it off, if you are not going to use it.

BTW, Thank you Johan for providing the code sample above...

Filed under: , , ,


No Comments

This Blog


    MVP - Microsoft Most Valuable Professional BizTalk User Group Sweden BizTalk blogdoc

    Follow me on Twitter Meet me at TechEd


    Locations of visitors to this page


    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.