使用本地Andorid模拟器访问本地IIS搭建的WebServices出现以下问题:
org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1 refused
百度搜了以下原因:
android模拟器把自己也当成127.0.0.1和localhost
解决办法:
1.在C:\Users\\Documents\IISExpress\config\applicationhost.config 里面修改配置信息
修改前:<binding protocol="http" bindingInformation="*:13985:localhost" />
修改后:<binding protocol="http" bindingInformation="*:13985:*" />
2.本地IIS访问链接中的localhost换成内网IP地址,如192.168.88.101。
原地址:http://localhost:13985/WebService/MusicServices.asmx/getMusicListReturnJson
修改后正常访问地址:http://192.168.88.101:13985/WebService/MusicServices.asmx/getMusicListReturnJson
参考资料:http://jingyan.baidu.com/article/c74d600081282b0f6b595d55.html