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

Mike S picture Mike S · Jan 25, 2014 · Viewed 46.6k times · Source

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:

Sub ShopXML4http(url, inStr, outStr, method, xmlerror)
  Dim objhttp
  Set objhttp = Server.CreateObject ("MSXML2.ServerXMLHTTP.6.0")
  objHttp.open method, url, false
  If Method="POST" Then
    objHttp.Send instr
  Else
    objHttp.Send
  End if   
  outstr=objHttp.responseText
  Set objhttp=nothing
End Sub

This code works fine almost all of the time (thousands of requests per day), but sporadically it will fail with a message like this:

Number: -2147012739

Description: An error occurred in the secure channel support

Source: msxml6.dll

The application was recently moved from an old Windows 2003 Server to the 2012 Server, and this issue never seemed to be a problem on the old server. In addition, while this error is happening on the website, I could run the exact same code in a VBScript and it works fine. Resetting the application pool seems to cause the site to be able to do the secure HTTP requests again (although it often fixes itself before I can get to the server).

Answer

user3087157 picture user3087157 · Oct 29, 2014

I have had the exact same problem after migrating from 2003 to 2008 R2 and found the solution. Change:

Set objhttp = Server.CreateObject ("MSXML2.ServerXMLHTTP.6.0")

to:

Set objhttp = Server.CreateObject ("MSXML2.XMLHTTP.6.0")

and your problem will go away.

I tried to find the pros and cons about both objects, but haven't yet found a reason to not use XMLHTTP.