0
votes

I m trying to save the file throw SFTP.Its working when i deployed on our company server but when i deployed on production server it give me error.Here is the code

 string host = "https://xyz.in";
    int port = 22; 
    string username = "abc";
    string password = "xyz"
    string SftpfolderName = "Images"

using (var client = new SftpClient(host, port, username, password))
            {
client.Connect();
}

using(var client = new sftpClient(host,port,username,password) throwing exception. below are the exception details

Web Application$|MethodName$|3017$|$|{"ClassName":"System.ArgumentException","Message":"host","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at Renci.SshNet.ConnectionInfo..ctor(String host, Int32 port, String username, ProxyTypes proxyType, String proxyHost, Int32 proxyPort, String proxyUsername, String proxyPassword, AuthenticationMethod[] authenticationMethods)\r\n at Renci.SshNet.PasswordConnectionInfo..ctor(String host, Int32 port, String username, Byte[] password, ProxyTypes proxyType, String proxyHost, Int32 proxyPort, String proxyUsername, String proxyPassword)\r\n at Renci.SshNet.SftpClient..ctor(String host, Int32 port, String username, String password)\r\n Renci.SshNet.AuthenticationMethod[])","HResult":-2147024809,"Source":"Renci.SshNet","WatsonBuckets":null,"ParamName":null}1/25/2017 11:54:24 AM

1

1 Answers

0
votes

i found the cause of this error..in my case the issue was, i added the "https://" in the host name when i removed "https://" from host name its working. now the code look like this

string host = "xyz.in";
int port = 22;
string username = "abc";
 string password = "xyz"
string SftpfolderName = "Images";
using (var client = new SftpClient(host, port, username, password))
        {
client.Connect();

}