2016-07-31 1 views
0

Azure 웹 응용 프로그램이 만드는 파일을 Azure 네트워크 외부의 FTP 서버로 전송하고 싶습니다. 내가 얻는 모든 것은 FTP상의 0 바이트 파일이고 "425 데이터 연결을 열 수 없습니다"웹 응용 프로그램에서 오류입니다.Azure 웹 사이트에서 FTP로 파일을 업로드 할 때 "425 데이터 연결을 열 수 없습니다"

Azure Web App 또는 FTP 서버에 누락 된 설정이 있습니까? 내 로컬 IIS Express의 동일한 웹 응용 프로그램이 올바르게 작동합니다.

FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(ftp + fileName); 
ftpRequest.Method = WebRequestMethods.Ftp.UploadFile; 
ftpRequest.Credentials = new NetworkCredential(uid, pwd); 
ftpRequest.ContentLength = fileBytes.Length; 

Stream requestStream = ftpRequest.GetRequestStream(); 
requestStream.Write(fileBytes, 0, fileBytes.Length); 
requestStream.Close(); 

FtpWebResponse response = (FtpWebResponse)ftpRequest.GetResponse(); 
var status = response.StatusCode; 
response.Close(); 

Acording to the MSDN 수동 모드가 기본이다 : 이것은 파일을 보내 사용하고 코드입니다

: 웹 응용 프로그램은 ASP .NET MVC 5.

EDIT 1을 사용합니다.

EDIT 2

System.Net Information: 0 : [60572] FtpControlStream#51898079 - Created connection from <origin_ip> to <destination_ip>. 
System.Net Information: 0 : [60572] Associating FtpWebRequest#23597360 with FtpControlStream#51898079 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Received response [220 Microsoft FTP Service] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Sending command [USER <user>] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Received response [331 Password required for <user>.] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Sending command [PASS *] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Received response [230 User <user> logged in.] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Sending command [OPTS utf8 on] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Received response [501 option not supported] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Sending command [PWD] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Received response [257 "/" is current directory.] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Sending command [TYPE I] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Received response [200 Type set to I.] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Sending command [PASV] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Received response [227 Entering Passive Mode (12,106,237,74,4,255).] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Sending command [STOR <file>] 
System.Net Information: 0 : [60572] FtpControlStream#51898079 - Received response [425 Can't open data connection.] 
System.Net Information: 0 : [60572] FtpWebRequest#23597360::(Releasing FTP connection#51898079.) 
System.Net Error: 0 : [60572] Exception in FtpWebRequest#23597360::GetRequestStream - The remote server returned an error: (425) Can't open data connection.. 
    at System.Net.FtpWebRequest.SyncRequestCallback(Object obj) 
    at System.Net.FtpWebRequest.RequestCallback(Object obj) 
    at System.Net.CommandStream.Dispose(Boolean disposing) 
    at System.IO.Stream.Close() 
    at System.IO.Stream.Dispose() 
    at System.Net.ConnectionPool.Destroy(PooledStream pooledStream) 
    at System.Net.ConnectionPool.PutConnection(PooledStream pooledStream, Object owningObject, Int32 creationTimeout, Boolean canReuse) 
    at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage) 
    at System.Net.FtpWebRequest.GetRequestStream() 

EDIT 3 :

가능 서버는이 출력 인 로그

또 다른 시도 :

System.Net Information: 0 : [58636] FtpWebRequest#9144495::.ctor(<ftp_address_and_file>) 
System.Net Information: 0 : [58636] FtpWebRequest#9144495::GetRequestStream(Method=STOR.) 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Created connection from <origin_ip> to <destination_ip>. 
System.Net Information: 0 : [58636] Associating FtpWebRequest#9144495 with FtpControlStream#57089836 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Received response [220 Microsoft FTP Service] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Sending command [USER <user>] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Received response [331 Password required for <user>.] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Sending command [PASS *] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Received response [230 User <user> logged in.] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Sending command [OPTS utf8 on] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Received response [501 option not supported] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Sending command [PWD] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Received response [257 "/" is current directory.] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Sending command [TYPE I] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Received response [200 Type set to I.] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Sending command [PASV] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Received response [227 Entering Passive Mode (12,106,237,74,5,4).] 
System.Net Information: 0 : [58636] FtpControlStream#57089836 - Sending command [STOR <file>] 
System.Net Information: 0 : [58636] FtpWebRequest#9144495::(Releasing FTP connection#57089836.) 
System.Net Error: 0 : [58636] Exception in FtpWebRequest#9144495::GetRequestStream - The operation has timed out.. 
    at System.Net.FtpWebRequest.SyncRequestCallback(Object obj) 
    at System.Net.FtpWebRequest.RequestCallback(Object obj) 
    at System.Net.CommandStream.Dispose(Boolean disposing) 
    at System.IO.Stream.Close() 
    at System.IO.Stream.Dispose() 
    at System.Net.ConnectionPool.Destroy(PooledStream pooledStream) 
    at System.Net.ConnectionPool.PutConnection(PooledStream pooledStream, Object owningObject, Int32 creationTimeout, Boolean canReuse) 
    at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage) 
    at System.Net.FtpWebRequest.GetRequestStream() 
+0

코드를 알려주십시오. 어떤 FTP 클라이언트/라이브러리를 사용하고 있습니까? –

+0

"로컬 IIS Express"와 동일한 네트워크에 FTP 서버가 있습니까? 아니면 다른 곳입니까? –

+0

아니요. FTP 서버가 publc IP를 사용하여 인터넷에 연결되어 있습니다. –

답변

0

에서 FTP 수동 모드로 전환 시도 당신의 고객.

0

"데이터 연결을 열 수 없습니다."은 전송을 위해 데이터 연결을 열 수 없으면 FileZilla FTP 서버에서 발급 한 메시지입니다.

일반적으로 클라이언트가 NAT 또는 방화벽 뒤에서 활성 FTP 모드를 사용하고 서버가 해당 IP 주소로 다시 연결할 수 없다는 것을 모른 채 내부 IP 주소를 서버에보고 할 때 발생합니다.

가장 쉬운 (일반적으로는 올바른) 해결책은 활성 모드 대신 FTP 수동 모드를 사용하는 것입니다.

활성 및 수동 모드의 의미와 현재 모든 사람이 수동 모드를 사용하는 이유를 이해하려면 article on FTP connection modes을 참조하십시오.

관련 문제