내 상황을 설명해 드리겠습니다.요청이 중단되었습니다. SSL/TLS 보안 채널을 만들 수 없습니다. 예외
자체 서명 된 인증서를 만들고 MMC의 섹션에 신뢰할 수있는 루트 인증 기관 섹션에 설치했습니다.
나는 다음 자체 서명 된 인증서를 사용하여 두 개의 인증서를 생성 :- 주체 이름을 가진 인증서 "localhost"를
I "test.com"주체 이름을 가진 인증서를 그런 다음 두 인증서를 MMC의 개인 인증서 섹션에 설치합니다.
그런 다음 웹 서비스를 IIS에 HTTPS (클라이언트 인증서를 수락하는 SSL)로 배포했습니다. 웹 서비스를 배포하는 데 사용되는 인증서는 주체 이름이 "localhost"인 인증서입니다.
이제 웹 서비스에 연결하려는 클라이언트가 있습니다. 성공적으로 웹 참조를 서비스에 추가했습니다. 이 코드는 다음과 같습니다.
ClientServices web_service = new ClientServices();
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
X509Certificate2Collection col = store.Certificates.Find(X509FindType.FindBySubjectName, "test.com", true);
if (col.Count == 1)
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
web_service.ClientCertificates.Add(col[0]);
try
{
string hello = web_service.HelloWorld();
int add = web_service.add(4, 31);
int sub = web_service.subtract(30, 10);
Console.WriteLine(hello);
Console.WriteLine(add);
Console.WriteLine(sub);
}
catch (WebException e)
{
Console.WriteLine(e.Message.ToString());
}
}
else
{
Console.WriteLine("The certificate was not found!");
}
Console.ReadKey();
본인의 웹 서비스 요청과 함께 "test.com"인증서를 보냅니다. 죄송하지만이 예외가 발생합니다 :
The request was aborted: Could not create SSL/TLS secure channel
이 문제를 어떻게 해결할 수 있습니까? 나는이 문제에 대해 이미 3 시간을 낭비했다. 도와주세요.
감사합니다. 나는 처음부터 다시 인증서를 생성하면서 문제를 해결할 수있었습니다. 그런 다음 완벽하게 작동했습니다. 나는 이유를 모르지만 그때는 효과가있었습니다. –