Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
998 views
in Technique[技术] by (71.8m points)

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

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).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...