简体   繁体   English

Windows FTP连接显示无法连接到远程服务器

[英]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 . 我已经在IIS 7中启用了Windows ftp,并且能够通过ftp://user:password@RBDRMSNMVM01进行连接。 However I tried the same through below C# snipet but I could not able to transfer the file. 但是,我通过下面的C#代码段尝试了相同的操作,但是无法传输文件。 It was failed at GetRequestStream() method call, which was saying "Unable to connect to the remote server" 在GetRequestStream()方法调用中失败,该消息说“无法连接到远程服务器”

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. 请检查strFTPConnString是否具有正确的服务器地址。

Also check if ports are being blocked by firewall. 还要检查端口是否被防火墙阻止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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