Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, one small question, am working on web service i have one url(with LocalHost) its working fine in browser when trying to connect from android its showing connection refused to localhost
Example Url:
http://localhost:33396/MainWEB.svc/DEChannel

this is URL when i open in browser its working fine but from android its getting exception connection refused..some body can help me on this
Posted

1 solution

Of course it won't. Here comes the virtualization in picture.

Quote:
Android will not be able to communicate with Visual Studio's Development Server, hence you would be required to deploy your services at IIS and with help from your local system IP address, provide DNS to Android.


You android emulator is a different device (or rather I'd say, device running the android OS) that runs on the same machine, which already have OS running on it.
Let me give you one simple example to understand this, your machine would have any IP address, but this emulator-AVD also would have the IP address, which is not as same as you machine's.

So it won't access any of the resources from your machine. If you're running this URL http://localhost:33396/MainWEB.svc on emulator itself, it won't work but in your local machine's browsers.

If you might have noticed the URL in my answer, it consist of machine's IP address.

So host your WCF service on your local IIS, access this service from IIS. Then you'd get service URL replacing localhost with your machine IP and that is accepted by AVD. For example URL would be, http://192.175.21.15/MainWEB.svc/.

You can get a help for hosting the WCF on IIS from,
http://msdn.microsoft.com/en-us/library/ms733766(v=vs.110).aspx[^]
A Beginner's Tutorial on How to Host a WCF Service (IIS Hosting and Self Hosting)[^]
Create, Host (Self Hosting, IIS hosting) and Consume WCF Service[^]

Hope you got the idea ! :)

-KR
 
Share this answer
 
Comments
mekalareddy 11-Mar-14 10:54am    
Thanks KR
mekalareddy 11-Mar-14 11:05am    
already its running in IIS KR
Krunal Rohit 11-Mar-14 11:10am    
Okay.!!

-KR
mekalareddy 11-Mar-14 11:12am    
but i am getting same problem Mr.KR
Krunal Rohit 11-Mar-14 11:13am    
How it could be possible ?
Are you able to access the service with URL in browser ?

-KR

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900