Server returned invalid or unrecognized response

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi there,
Im customizing an off-the-shelf application consisting of default html template files as a classic ASP application. My code uses MSXML, which was working fine in a Windows Server 2003/iis6 environment, but once we transitioned to Windows Server 2008/iis
7, the following error has been occurring frequently:
Error number: -2147012744, Error description: The server returned an invalid or unrecognized response , Error source: msxml3.dll
While we did see this error in our Dev environment with Win server 2003/iis 6, it didnt happen very often and I added some code to handle it. In the new environment in Prod, its occurring way too often and the handling code is useless there. We have tried
a variety of things, including upgrading to MSXML4 SP3, putting <httpWebRequest useUnsafeHeaderParsing="true" /> in a web.config file, playing around with the setTimeout methods, etc. Nothing we tried has worked. One thing I noticed is that when this
error occurs, the serverXmlHttp readyState property stays at 1. The definition for that readyState value is: (1) LOADING The object has been created but the send method has not been called. For some reason its as though the Send method doesnt get called.
Here is my code. Any insight would be appreciated.
<span style="font-size:x-small; font-family:Courier New <span style="font-size:x-small; font-family:Courier New
//Set up SOAP object:
Set xmlHttp = Server.CreateObjec("MSXML2.ServerXMLHTTP.3.0")
xmlHttp.Open "GET", destUrl, false
xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlHttp.setOption 2,SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS

//Send SOAP request and determine if error occurred:
Dim blnError
blnError = false
On Error Resume Next
xmlHttp.Send()
Response.Write xmlHttp.readyState
If (Err.Number <> 0) Then
blnError = true
//Loop below is to resolve random invalid/unrecognized response server error. Loop iterates until error is gone or 4 times max,
//after which point code execution continues normally, or the remaining/other error is handled
For count = 0 to 3
If (Err.Number = -2147012744 OR Err.Number = -2147012894) Then
//i.e. random error "server returned an invalid or unrecognized response"
On Error Resume Next
xmlHttp.Open "GET", destUrl, false
xmlHttp.Send()
Response.Write xmlHttp.readyState
Else
Exit For
End If
Next

If (Err.Number <> 0) Then
errMsg = "Error number: " & Err.Number & ", Error description: " & Err.Description & ", Error source: " & Err.Source
Err.Number = 0
Else
blnError = false
End If
End If

If (blnError = false) Then
//If status is 200 then request succeeded, so display search results:
If (xmlHttp.status = 200) Then
RsltsXML = xmlHttp.ResponseText
Response.Write(RsltsXML)

Else
blnError = true
errMsg = Error number:" & xmlHttp.status & ",Error description:" & xmlHttp.statusText & ",Details: " & xmlHttp.ResponseText
End If
End If

Set xmlHttp = Nothing //clear HTTP object
If (blnError = true) Then
//Handle any error that occurred by sending an email and redirecting to generic error screen
End If


<span style="font-size:x-small; font-family:Arial <span style="font-size:x-small; font-family:Arial

View the full article
 
Back
Top