检查是否其它Web服务器正在从ASP监听 [英] Checking if another web server is listening from asp

查看:172
本文介绍了检查是否其它Web服务器正在从ASP监听的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Microsoft.XMLHTTP获取从一个旧的ASP / VBScript的站点的另一台服务器的一些信息。但是,其他服务器重启相当频繁,所以我要检查它的启动和运行试图拉从它的信息(或避免通过检测问题的一些其他的方式给予一个HTTP 500我的网页)之前。

I'm using Microsoft.XMLHTTP to get some information from another server from an old ASP/VBScript site. But that other server is restarted fairly often, so I want to check that it's up and running before trying to pull information from it (or avoid my page from giving an HTTP 500 by detecting the problem some other way).

我怎么能做到这一点与ASP?

How can I do this with ASP?

推荐答案

所有你需要做的是有code继续错误,然后发布到其他服务器和读取后的状态。事情是这样的:

All you need to do is have the code continue on error, then post to the other server and read the status from the post. Something like this:

PostURL = homelink & "CustID.aspx?SearchFlag=PO"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.3.0")

上的错误恢复下一步

xmlhttp.open "POST", PostURL, false
xmlhttp.send ""

状态= xmlhttp.status

if err.number <> 0 or status <> 200 then
    if status = 404 then
        Response.Write "ERROR: Page does not exist (404).<BR><BR>"
    elseif status >= 401 and status < 402 then
        Response.Write "ERROR: Access denied (401).<BR><BR>"
    elseif status >= 500 and status <= 600 then
        Response.Write "ERROR: 500 Internal Server Error on remote site.<BR><BR>"
    else
        Response.write "ERROR: Server is down or does not exist.<BR><BR>"
    end if
else
    'Response.Write "Server is up and URL is available.<BR><BR>"
    getcustomXML = xmlhttp.responseText
end if
set xmlhttp = nothing

这篇关于检查是否其它Web服务器正在从ASP监听的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆