我花了很多时间连接本地数据库抛出jdbcOdbcDrivr。许多人建议我从android应用程序抛出web服务连接数据库。 WCF是制作Web服务的绝佳解决方案,我这样做并将Web服务发布到本地IIS服务器。从android连接到sql服务器抛出web服务WCf
当我使用直接
url 192.168.0.1:90/Service1.svc/checkLogin?name=a&pass=1
它工作正常。
当我的Andriod应用
HttpGet httpGet=new HttpGet(
"192.168.0.1:90/Service1.svc/checkLogin?name='"+UserName+"'&pass='"+Password);
使用它没有工作。
请告诉我能做些什么来解决这个问题
HttpGet httpGet = new HttpGet(“http://192.168.0.1:90/Service1.svc/checkLogin?name='”+ UserName +“'&pass ='”+ Password); \t HttpResponse httpResponse = httpClient.execute(httpGet); 当我调试我的应用程序,这是去 赶上(例外五) \t { \t \t返回FALSE; \t} 当它来到这些行 HttpResponse httpResponse = httpClient.execute(httpGet); – user2839125
错误是org.apache.http.conn.HttpHostConnectException:连接到http:// localhost:90拒绝 – user2839125
在android中编码时不使用localhost。因为android本身使用localhost。而是使用IP地址。并添加http://之前的IP地址 –