1 using MSXML2;
public bool InterfaceEnble() 2 { 3 string url = "http://localhost:81/WebServiceLogin.asmx"; 4 XMLHTTP http = new XMLHTTP(); 5 try 6 { 7 http.open("GET ", url, false, null, null); 8 http.send(null); 9 int iStatus = http.status; 10 //如果状态不为200,就是不能调用此接口 11 if (iStatus == 200) 12 return true; 13 } 14 catch (Exception ex) 15 { 16 MessageBox.Show("接口调用失败," + ex); 17 } 18 19 return false; 20 }
判断接口是否可用