IIS7 "Request aborted: Failed to create SSL/TLS secure channel" workaround

Source: Internet
Author: User


First, import the certificate

1. Click Start, click Run, type mmc, and then click OK.
2. On the File menu, click Add/Remove Snap-in.
3. Select the certificate in the list of available snap-in and click Add.
4. Select the computer account in the Certificate Management dialog box and click Next
5. In the Select Computer dialog box, click Finish.
6. In the Add or Remove Snap-in dialog box, click OK.
7. Expand Certificates (Local computer), expand Personal, and then click Certificates.
8. Right button-"All Tasks-" Import Select your certificate import

II. Installation of Authorization tools

1. Download WinHttpCertCfg.exe Installation

2. After installation, use the command window to jump to C:\Program files\windows Resource kits\tools execute winhttpcertcfg-g-C local_machine\my- S "Your certificate name"-A "EVERYONE"

Third, use the imported certificate in the code

      //Create an HTTP request

HttpWebRequest HttpRequest = (HttpWebRequest) httpwebrequest.create (strURL);
Servicepointmanager.expect100continue = true;
Servicepointmanager.securityprotocol = SECURITYPROTOCOLTYPE.SSL3;

//to add a callback method for validating a certificate

Servicepointmanager.servercertificatevalidationcallback =
(ObjectSender, X509Certificate certificate, X509chain chain, sslpolicyerrors sslpolicyerrors) = {returntrue; };
//find a system-imported certificate
X509store Certstore =NewX509store (storename.my, storelocation.localmachine);
Certstore.open (openflags.readonly);
X509Certificate2Collection certcollection = CertStore.Certificates.Find (X509findtype.findbysubjectname,"Test",false);

      //to add a certificate to the request objectHTTPREQUEST.CLIENTCERTIFICATES.ADD (certcollection[0]);

Request code slightly ...

IIS7 "Request aborted: Failed to create SSL/TLS secure channel" workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.