An error occurred in the secure channel support - Classic ASP HTTP Request

后端 未结 8 1608
悲&欢浪女
悲&欢浪女 2020-12-29 03:02

I have a classic ASP website running on a Windows Server 2012 box. One page makes a HTTP request to another application over https using code like this:



        
8条回答
  •  半阙折子戏
    2020-12-29 03:28

    In a Windows Server 2016 Classic ASP script, fetching an HTTPS URL from Windows Server 2012 R2, I recently had to remove SSL 2.0 from SecureProtocols in order to stop this secure channel error -2147012739.

    ' Use the latest client
    Set httpClient = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
    
    ' allow only TLS 1.2 or TLS 1.1
    Const WHR_SecureProtocols = 9
    httpClient.Option(WHR_SecureProtocols) = &h0800 + &h0200 
    ' Other values: TLS 1.0 &h0080, SSL 3.0 &h0020, SSL 2.0 &h0008 
    ' NB Including SSL 2.0 stops https to Windows Server 2012 R2 working
    
    ' Other options you may want to set, from https://docs.microsoft.com/en-us/windows/desktop/winhttp/winhttprequestoption 
    
    ' Ignore certificate errors
    Const WHR_SslErrorIgnoreFlags = 4
    httpClient.Option(WHR_SslErrorIgnoreFlags) = &h3300 
    
    ' Don't bother checking cert, or risking failure if we can't check
    Const WHR_EnableCertificateRevocationCheck = 18
    httpClient.Option(WHR_EnableCertificateRevocationCheck) = False 
    

提交回复
热议问题