这个问题困扰了我很长很长的时间,在跨域获取数据的时候就要用到服务器端的对象,以前一直用的是Msxml.XMLHTTP。但是问题太多了,特别严重的就是你在获取数据的时候不知道对方服务器的状态,如果对方挂了那客户端只能傻傻的等待着。在做天气预报的时候这个问题总是困扰着我。今天重点解决了一下,搜了一箩筐关于这方面的信息。终于找到了我早思幕想的Msxml2.ServerXMLHTTP,她具有一个setTimeouts的属性,默认响应超时时间竟然是1小时 。可想我要是想获得中国500多个城市的气象信息,而对方服务器或网络正好又当了,那将是个啥工程(500×3605秒)。
解决这个问题就是用对象Msxml2.ServerXMLHTTP,并给她设置操作的超时时间。来看看这个对象的属性setTimeouts都有那些参数。

Parameters
解析响应时间
resolveTimeout
数据类型:长整型。简单地说就是程序对目标主机的名字解析解析的一个过程时间。默认值是无限制,就是意味着不会超时
A long integer. The value is applied to mapping host names (such as "www.microsoft.com") to IP addresses; the default value is infinite, meaning no timeout.
连接响应时间
connectTimeout
数据类型:长整型。程序和目标服务器socket建立一个通讯。默认超时时间为60秒。
A long integer. The value is applied to establishing a communication socket with the targrt server, with a default timeout value of 60 seconds.
发送请求数据响应时间
sendTimeout
数据类型:长整型。 发送数据包给目标服务器,一个大的数据包通常被分割成若干个小的数据包来一个个的发送,程序发送各个数据包的发送响应超时时间。默认值是5分钟。
A long integer. The value applies to sending an individual packet of request data (if any) on the communication socket to the target server. A large request sent to a server will normally be broken up into multiple packets; the send timeout applies to sending each packet individually. The default value is 5 minutes.
接受数据响应时间
receiveTimeout
数据类型:长整型。从目标服务器返回的数据包。一个大的数据包通常被分割成若干个小的数据包来一个个的发送,程序从服务器接受各个数据包的响应超时时间。默认为 60分钟
A long integer. The value applies to receiving a packet of response data from the target server. Large responses will be broken up into multiple packets; the receive timeout applies to fetching each packet of data off the socket. The default value is 60 minutes.
使用方法(Javascript)
[codes=js]var XMLhttp= Server.CreateObject("Msxml2.ServerXMLHTTP");
XMLhttp.setTimeouts(10000,10000,10000,30000);//顺序按上面依次排列,单位毫秒[/codes]如果参数里的某一个超时那将超时返回,返回的COM异常错误码是0x80072EE2。