Kunwar Singh
Kunwar Singh

Reputation: 67

view website running on local machine via android

I have a webservice in c# ,I want to access it via my android device through adhoc , I am able to get it in emulator using 10.0.2.2; but can't see on android device, Kindly suggest me any method to access that.

This is online webservice on w3school i am able to access it via my android device

  private final String NAMESPACE = "http://www.w3schools.com/webservices/";
  private final String URL =     "http://www.w3schools.com/webservices/tempconvert.asmx";
  private final String SOAP_ACTION = "http://www.w3schools.com/webservices/CelsiusToFahrenheit";
 private final String METHOD_NAME = "CelsiusToFahrenheit"; 

This is url of my local webservice http://localhost:63693/Notif.asmx unable to access via android phone , though in emultor it is working http://10.0.2.2:63693/Notif.asmx

Upvotes: 2

Views: 435

Answers (3)

Kunwar Singh
Kunwar Singh

Reputation: 67

You also need to turn windows feature on . Go to -> Control Panel -> Add or Remove Program -> Turn Windows feature on or off -> .Net framework 4.5 advanced service -> WCF Services -> HTTP Activation . Enable this and Restart ur PC .

Use adhoc on android and connect your machine to it, simply use MachineIP:PortNo/Webservice.asmx

For custom IP - Enable IIS in turn features on or off .Run inetmgr via administrator and add your website there after that right Click edit bindings use IP or hostname whatever you want.

Upvotes: 0

Deepika Rajani
Deepika Rajani

Reputation: 564

If you are running your webservice on localhost then you can run it in emulator using address http://10.0.2.2:63693/Notif.asmx.

And if you want to run it live on phone then either you have to host your service on some Server.

For accessing localhost service on live phone, the phone and service(machine on which service is being hosted locally) must run on same Private network. You need to then call the Private address of machine from android app. With Private address, I mean IPv4 address of machine. E.g., http://192.168.1.180:63693/Notif.asmx

You can get IPv4 of machine from ipconfig command in cmd.

Upvotes: 1

thestrongenough
thestrongenough

Reputation: 225

If you want to access the website on your device then your PC and your android device should be on same network and same subnet.

Then yourIP:port in address in url you can access your website on your android device

Upvotes: 0

Related Questions