내가 지불하는 호스트 서버에서 작동하도록 사용자 정의 FTP 클래스를 구현했습니다. 내 응용 프로그램의 백업, 복원 및 업데이트에 FTP를 사용합니다. 저는 지금 ssl이 이것을 프로덕션 환경에 적용 할 수있게하려고합니다. 저는 호스팅 회사에 SSL 프로토콜을 지원하는지 물었고 그들이 말했습니다.EnableSSL을 사용하는 FtpWebRequest
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(m_ftpAddress.Trim()));
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(m_ftpUsername, m_ftpPassword);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
X509Certificate cert = new X509Certificate(path to a certificate created with makecert.exe);
reqFTP.ClientCertificates.Add(cert);
reqFTP.AuthenticationLevel = AuthenticationLevel.MutualAuthRequested;
reqFTP.ImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification;
reqFTP.EnableSsl = true;
이제, MSDN 서버가 SSL 프로토콜을 지원하는 경우 AUTH TLS로 물었을 때 그것을 던져 예외하지 않습니다 말한다 :
그래서 나는 이런 일에 마이크로 소프트 MSDN 튜토리얼 후에 나의 방법을 수정했습니다. 이것은 추적 로그에서 볼 수 있습니다. 그래서 저는 그것이 서버 문제가 아니라고 봅니다. 나는 얻을내가 false로System.Net Error: 0 : [0216] Exception in the FtpWebRequest#12547953::GetResponse - The remote server returned an error: 227 Entering Passive Mode (the IP and port number).
reqFTP.UsePassive = true;
속성을 설정하려고
과 :
은 인증 단계 후 서버가 오류를 트리거하는
System.Net Information: 0 : [0216] FtpControlStream#41622463 - Received response [227 Entering Passive Mode (the IP and port number).]
메시지를 반환 이 오류 :
System.Net Information: 0 : [2692] FtpControlStream#4878312 - Received response [500 Illegal PORT command]
물론 EnableSLL 속성을 true로 설정하지 않으면 모든 문제없이 작동합니다.
누구에게도이 아이디어가 있습니까?
편집 :
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(m_ftpAddress.Trim()));
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(m_ftpUsername, m_ftpPassword);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
ServicePointManager.ServerCertificateValidationCallback = new
System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
reqFTP.ClientCertificates.Add(cert);
reqFTP.AuthenticationLevel = AuthenticationLevel.MutualAuthRequested;
reqFTP.ImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification
reqFTP.EnableSsl = true;
ValidateServerCertificate
항상 사실를 반환 나는 휴한지로 코드를 수정했습니다. 이 수정 후에 그 효과는 전혀 없습니다.
그리고 이해가 안 :이 순간에
- 응용 프로그램이 바로, 서버 인증서를 사용?
- 수정하기 전에도 광산을 사용하고 있었습니까?
누군가가 내 작품을 어떻게 설명 할 수 있습니까?
편집 : 많은 이메일을 호스팅 회사와 교환 한 결과 FTP 소프트웨어에 문제가 있다는 것을 알았지 만 코드에는 아무런 문제가 없었습니다.
그런 다음 수정 사항을 답변으로 게시하고 수락하십시오. –