0
을 던져 않습니다왜 내 ListDirectory FTP 요청 내가 다음 코드 한 예외
var listDirectoryFtpRequest = (FtpWebRequest) WebRequest.Create(directoryUri);
listDirectoryFtpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
listDirectoryFtpRequest.Credentials = /* my credentials */;
listDirectoryFtpRequest.KeepAlive = false;
listDirectoryFtpRequest.UsePassive = true;
listDirectoryFtpRequest.UseBinary = true;
using (var response = listDirectoryFtpRequest.GetResponse())
{
return true;
}
directoryUri
에 저장되어있는 디렉토리는 존재한다.
나는 그럼에도 불구하고 나는 예외 다음 얻을
(022102) 30.05.2012 08:32:18 - **USER** (213.235.245.89)> 230 Logged on
(022102) 30.05.2012 08:32:19 - **USER** (213.235.245.89)> OPTS utf8 on
(022102) 30.05.2012 08:32:19 - **USER** (213.235.245.89)> 200 UTF8 mode enabled
(022102) 30.05.2012 08:32:20 - **USER** (213.235.245.89)> PWD
(022102) 30.05.2012 08:32:20 - **USER** (213.235.245.89)> 257 "/" is current directory.
(022102) 30.05.2012 08:32:21 - **USER** (213.235.245.89)> CWD /21792543/2/
(022102) 30.05.2012 08:32:21 - **USER** (213.235.245.89)> 250 CWD successful. "/21792543/2" is current directory.
(022102) 30.05.2012 08:32:22 - **USER** (213.235.245.89)> TYPE I
(022102) 30.05.2012 08:32:22 - **USER** (213.235.245.89)> 200 Type set to I
(022102) 30.05.2012 08:32:23 - **USER** (213.235.245.89)> PASV
(022102) 30.05.2012 08:32:23 - **USER** (213.235.245.89)> 227 Entering Passive Mode (10,40,31,10,229,112)
(022102) 30.05.2012 08:32:27 - **USER** (213.235.245.89)> NLST
(022102) 30.05.2012 08:32:27 - **USER** (213.235.245.89)> 150 Connection accepted
(022102) 30.05.2012 08:32:27 - **USER** (213.235.245.89)> 226 Transfer OK
(022102) 30.05.2012 08:32:29 - **USER** (213.235.245.89)> disconnected.
내 FTP 서버에서 로그를 다음 있습니다 :
System.Net.WebException: The underlying connection was closed: The server committed a protocol violation.
at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
at System.Net.FtpWebRequest.RequestCallback(Object obj)
at System.Net.CommandStream.InvokeRequestCallback(Object obj)
at System.Net.CommandStream.Abort(Exception e)
at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
at System.Net.FtpWebRequest.GetResponse()
at **MYCLASS**.**MYMETHOD**
이유는 무엇입니까? ... 어떻게 해결할 수 있습니까?
추신 : 나는 비슷한 증상을 가지고 있으므로 여기에 another question을 발견했습니다. 그러나 나는 정말로 KeepAlive = true
-hack에 가야만합니까?
I을 이 같은 문제가 너무 있습니다. .NET FTP 공급자가 몇 개 있지만 System.Net.FtpClient가 오류를 해결 한 유일한 사람입니까? 이 프로젝트는 아직 베타 버전이므로 사용하기를 주저합니다. – HBCondo
System.Net.FtpClient는 (사용하기 쉽고 편리한 인터페이스 인) 사용하기 쉬운 유일한 ftp-client이었고 (예를 들어 다중 레벨 디렉토리 검사와 같은) 많은 것들을 수행해야했습니다. 자신을 구현하십시오 ... 베타 상태로 조금 두려워했지만, 실제로 기업 환경에서 이것을 사용하고 있습니다. 예, 매력과 같습니다! –