简体   繁体   中英

Windows FTP Connection says Unable to connect to the remote server

I've enabled windows ftp in IIS 7 and able to connect through ftp://user:password@RBDRMSNMVM01 . However I tried the same through below C# snipet but I could not able to transfer the file. It was failed at GetRequestStream() method call, which was saying "Unable to connect to the remote server"

strUserName = FTP Windows Server login user id
strPwd      = FTP Windows Server login password

FtpWebRequest request = null;
FileStream fs = null;
Stream reqStream = null;

request = (FtpWebRequest)FtpWebRequest.Create(strFTPConnString);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(strUserName, strPwd);

reqStream = request.GetRequestStream();
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Close();

Any help would be greatly appreciated !!!

Please Check whether strFTPConnString has the correct server address.

Also check if ports are being blocked by firewall.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM