Пример #1
0
        public Hashtable TestWcf()
        {
            Hashtable map = new Hashtable();
            string    url = Serversurl;

            string[] urllist = url.Split(';');
            for (int i = 0; i < urllist.Length; i++)
            {
                if (string.IsNullOrEmpty(urllist[i]))
                {
                    continue;
                }
                ServerXMLHTTP http = new MSXML2.ServerXMLHTTP();
                http.setTimeouts(0, 3000, 1000, 1000);
                try
                {
                    http.open("GET", url, false, null, null);
                    http.send(url);
                    int status = http.status;
                    if (status == 200)
                    {
                        map.Add(urllist[i], "成功");
                    }
                    else
                    {
                        map.Add(urllist[i], "不可用status:" + status.ToString());
                    }
                }
                catch
                {
                    map.Add(urllist[i], "不可用");
                }
            }
            return(map);
        }
Пример #2
0
        public Hashtable TestNginx()
        {
            Hashtable     map  = new Hashtable();
            string        url  = Nginxurl;
            ServerXMLHTTP http = new MSXML2.ServerXMLHTTP();

            http.setTimeouts(0, 3000, 1000, 1000);
            try
            {
                http.open("GET", url, false, null, null);

                http.send(url);
                int status = http.status;
                if (status == 200)
                {
                    //Console.WriteLine(System.Text.Encoding.Default.GetString(http.responseBody));
                    map.Add("status", "成功");
                }
                else
                {
                    map.Add("status", "不可用status:" + status.ToString());
                }
            }
            catch
            {
                map.Add("status", "不可用");
            }
            return(map);
        }