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)) 
            { 
                try 
                { 
                    sftp.Connect(); 
                    Console.WriteLine("Connected"); 
                    sftp.Disconnect(); 
                } 
                catch (Exception ex) 
                { 
                    Console.WriteLine("-=<>=- EXCEPTION"); 
                    Console.WriteLine(ex.Message); 
                    Console.WriteLine(ex.StackTrace); 

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

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

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: , , ,

Comments

No Comments

This Blog

News

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

    Follow me on Twitter Meet me at TechEd

    Visitors

    Locations of visitors to this page

    Disclaimer

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

Syndication