seePING UTILITY and WEBSERVICE in C# .NET
http://www.eggheadcafe.com/articles/20020209.asp

解决方案 »

  1.   

    i.e., try to ping your server to see if it is online, also seehttp://www.csharphelp.com/archives2/archive296.html
    http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1509&lngWId=10
      

  2.   

    以下是我在windows 服务中去定时调用web service时的判断, 比较稳定用HttpWebRequest会记住状态, 如果IP一次不能访问, 除非重启服务, 否则一直
    引用MSXML2.dll
    using MSXML2;
    string url = "xxxx";
    XMLHTTP http = new XMLHTTP();
    try
    {
    http.open("GET", url, false, null, null);
    http.send(null);
    int iStatus = http.status;
    //如果取得的网页状态不正确, 就是不存在或没权访问
    if(iStatus != 200)
    return -1;
    }
    catch(Exception ex)
    {
    Console.Write(ex.ToString());
    try
    {
    EventLog.WriteEntry("xxxxx", url + "不能访问!", EventLogEntryType.Error);

    }
    catch{}
    return -1;
    }
      

  3.   

    请问在一个webapplication 怎样使用XMLHTTP对象
      

  4.   

    webform里也一样使用, 不过EventLog.WriteEntry()这句就别在web上执行了
      

  5.   

    panyee(快乐王子) :
    你老哥的方法不行呀,哪个webservice即使可以正常使用http.status的值也不是200,而是500:请求格式无法识别
      

  6.   

    string url = "http://xxxx/MyWeb/service1.asmx";你是不是这样写的? xmlhttp只是最基本的试探那个页面是否显示正常500是服务器错误
    403是拒绝访问
    404页面不存在
      

  7.   

    url你写的是什么? xmlhttp是探测asmx页面是否正常
      

  8.   

    string url = "http://xxxx/MyWeb/service1.asmx";
    我写的就是这个呀
      

  9.   

    我这里一直那么应用的, 其它机器浏览你的asmx页面是否正常?