2016-10-29 2 views
0

I ve faced with very strange issue that i m 2 일 동안 고생했습니다. 나는 몇몇 dev 컴퓨터에서 아래 코드를 실행하려고 시도했지만 성공적으로 실행 중입니다. 내가 시도 할 때 윈도우 서버 2008 R2와 프로덕션 서버에서 실행하기 -이 메시지와 함께 실패Windows 서버 2008 R2에서 SSL/TLS 보안 채널을 만들 수 없습니다.

SSL/TLS 보안 채널을 여기에

를 만들 수 없습니다하는 코드 예제입니다

:

try 
     { 
      Console.WriteLine(ServicePointManager.SecurityProtocol); 
      ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | 
                SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; 
      ServicePointManager.Expect100Continue = true; 
      ServicePointManager.ServerCertificateValidationCallback += 
       (sender, certificate, chain, sslPolicyErrors) => true; // ignoring certificate errors 
      Console.WriteLine(ServicePointManager.SecurityProtocol); 
      using (var client = new WebClient()) 
      { 
       client.DownloadString("https://smlegacygateway-integration.mysmartmove.com/LandlordApi/v1/ServerTime"); 
      } 
     } 
     catch (Exception ex) 
     { 
      Console.WriteLine("Something goes wrong"); 
      Console.Write(ex); 
     } 

     Console.WriteLine("Everything is fine."); 
     Console.ReadLine(); 

Windows Server 2008 R2에서만 실패한 이유에 대해 도움을 주시겠습니까 ??? Windows Server 2012에서 실행 해 보았습니다. 모든 것이 정상입니다.

P. 관리자 권한을 가진이 콘솔 앱을 실행하므로 권한의 갭과 관련이 없어야합니다. 미리 감사드립니다.

답변

0

솔직히 나는 이유를 모른다. Windows 2012가 Windows crypto 알고리즘을 지원하지 않기 때문에 Windows 2012가 새로운 암호 알고리즘을 지원할 수 있다고 생각합니다.

this ssl test에 따르면 서버는 TSL 1.2 및 TSL 1.1 만 지원하며 일부만 암호화 제품군을 선택합니다. 통과 된 모든 핸드 셰이크 테스트는 TSL 1.2를 사용하여 수행되었으므로이 프로토콜을 ServicePointManager.SecurityProtocol에 사용할 것입니다.

Windows 2008에서 연결이 실패한 이유는 CAPI2 이벤트 로그에서 찾을 수 있습니다. 먼저 사용하도록 설정 한 다음 서버 (smlegacygateway-integration.mysmartmove.com)에 다시 연결하십시오. CAPI2 event log

아, 최종 조언. 제발하지 마십시오 :

ServicePointManager.ServerCertificateValidationCallback += 
       (sender, certificate, chain, sslPolicyErrors) => true; // ignoring certificate errors 

인증서 유효성 검사를 구현해야한다면 그것을 구현하십시오. 항상 사실로 돌아 오는 것은 좋은 선택이 아닙니다. 오버라이드 할 필요가 없다면 만지지 마십시오.

관련 문제