2009-05-28 2 views
0

품질 보증 환경에 일치하지 않는 SSL 인증서가있는 클라이언트가 있습니다. 우리는 Azure 웹 역할 내에서 SSL로 보호 된 웹 리소스에 HttpWebRequest 호출을하고 있습니다. 인증서를 가져 오려면 ServicePointManager.CertificatePolicy를 모든 인증서를 허용하는 새 정책으로 설정합니다. 이것은 완전 신뢰 환경에서 작동하지만 완전 신뢰 이하의 Azure 환경에서 CertificatePolicy를 설정하려고 할 때 SecurityPermission 예외로 실패합니다. 애저 (Azure) 서비스 내에서 전화를 걸 수있는 방법이 있습니까?Azure에서 일치하지 않는 인증서로 사이트에 SSL HttpWebRequest가 있습니까?

답변

0

나는 내 자신의 질문에 답할 것입니다!

분명히 완전 신뢰로 실행하려면 웹 역할 구성에서 NativeCodeExecution = "true"로 설정하면됩니다.

0

뭔가있을 수 있습니까?

System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate (
    object sender, 
    X509Certificate cert, 
    X509Chain chain, 
    SslPolicyErrors sslPolicyErrors) 
{ 
    if (sslPolicyErrors == SslPolicyErrors.None) 
    { 
     return true; //Is valid 
    } 
    //Add the mismatched certificate hashstring below. 
    //That way only that resource will be affected and not all certificates will be trusted. 
    if (cert.GetCertHashString() == "99E92D8447AEF30483B1D7527812C9B7B3A915A7") 
    { 
     return true; 
    } 

    return false; 
}; 
관련 문제