Hi all
I'm using an XmlHTTP object to retrieve information from Outlook Web Access. I'm calling the send() method asynchronously and then trying to determine in a loop whether the readyState is 4 (COMPLETE). If I run this code in a Windows Form or a Console Application - it runs fine but if I try to run it from a Windows Service - it returns the error "The handle is invalid" when I try to check the readyState after calling the waitForResponse() method the first time.
Has anyone come across this error before?
My code is as follows:
Thanks as always
Craftor

I'm using an XmlHTTP object to retrieve information from Outlook Web Access. I'm calling the send() method asynchronously and then trying to determine in a loop whether the readyState is 4 (COMPLETE). If I run this code in a Windows Form or a Console Application - it runs fine but if I try to run it from a Windows Service - it returns the error "The handle is invalid" when I try to check the readyState after calling the waitForResponse() method the first time.
Has anyone come across this error before?
My code is as follows:
Code:
MSXML2.ServerXMLHTTP40Class xmlHttp = new ServerXMLHTTP40Class();
xmlHttp.open("PROPFIND", serverUrl, true, username, password);
xmlHttp.setRequestHeader("SQL", folderQuery);
xmlHttp.setRequestHeader("Content-type", "text/xml");
xmlHttp.setRequestHeader("Depth", "1");
xmlHttp.send(null);
while (true)
{
// error occurs the second time this is accessed.
if (xmlHttp.readyState != 4)
{
// waiting
xmlHttp.waitForResponse(5);
}
else
{
folderList = xmlHttp.responseText;
break;
}
}
Thanks as always
Craftor