这个url在浏览器能访问成功,获得json数据。并且我自己写httpclent请求访问也能够获得数据。但是在使用Async-http的post方法时连方法都无法进入!
服务器端是C#
private static AsyncHttpClient mClient =new AsyncHttpClient();
public static void post(String url, JsonHttpResponseHandler handler) {
mClient.post(url, handler);
}
//发起请求
MyHttpClient.post("http://x.x.x.x/XXXX/Android/GetBuildings",
new JsonHttpResponseHandler(){
@Override
public void onSuccess(String content) {
super.onSuccess(content);
System.out.println("S---------"+content);
}
@Override
public void onFailure(Throwable error,
String content) {
super.onFailure(error, content);
System.out.println("F----------"+content);
}
});
服务端代码:
public JsonResult GetBuildings() {
try
{
_iPhoneEstateMTBll = UnityHelper.GetServer();
List listBuildings = _iPhoneEstateMTBll.GetHouseList();
List list = new List();
for (int i = 0; i < listBuildings.Count; i++) {
list.Add(listBuildings[i][5].ToString());
}
return Json(list, JsonRequestBehavior.AllowGet);
}
catch (Exception)
{
throw;
}
}
不知道哪里错了!求大神帮助