0
我已經在IIS 7中啓用了windows ftp並且能夠通過ftp://user:[email protected]
連接。不過,我通過下面的C#snipet嘗試過,但我無法傳輸該文件。 它未能在GetRequestStream()方法調用,這是說「無法連接到遠程服務器」Windows FTP連接說無法連接到遠程服務器
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 !!!
你說得對,問題出在IP地址上。我使用了虛擬IP地址,而不是有效的IP地址。它在更改爲原始IP後正在工作。 – Smaug 2013-03-15 05:49:01