简体   繁体   English

从android抛出Web服务WCf与sql server连接

[英]connect with sql server from android throw web service WCf

I spent lot of time to connect with local Database throw jdbcOdbcDrivr. 我花了很多时间与本地数据库抛出jdbcOdbcDrivr连接。 Many people advice me to connect with database from android app throw web service. 许多人建议我从android app throw Web服务连接数据库。 WCF is great solution for making web services , i do that and publish the web services to local IIS sever. WCF是制作Web服务的绝佳解决方案,我可以这样做并将Web服务发布到本地IIS服务器。

When i use the direct 当我使用直接

url 192.168.0.1:90/Service1.svc/checkLogin?name=a&pass=1

it works fine. 它工作正常。

When i used from andriod app 当我从Andriod应用程序使用时

HttpGet httpGet=new HttpGet(
    "192.168.0.1:90/Service1.svc/checkLogin?name='"+UserName+"'&pass='"+Password); 

It did not work. 这没用。

Please tell what can i do to fix this problem 请告诉我该怎么做才能解决此问题

how about adding: "http://" before this: 192.168.0.1:90/Service1.svc/checkLogin?name='"+UserName+"'&pass='"+Password 如何添加:在此之前添加:“ http://”:192.168.0.1:90/Service1.svc/checkLogin?name='"+UserName+"'&&pass='"+Password

so you will have: 因此您将拥有:

http://192.168.0.1:90/Service1.svc/checkLogin?name='"+UserName+"'&pass='"+Password

请注意,如果您使用的是Android模拟器,并且您的Web服务在本地IIS服务器上运行,则必须将ip主机添加到android主机文件中,如下所示: http://mcilvena.com/articles/modify-android-host-file /

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM