6

I have an ASP.net Web API in my laptop with this address :

localhost:99949

I add this to IIS Express that I can access my web Api from another computer in same lan network , and it's going this:

Nimis:80

I can access to my web api from other PCs , but when I try to access this with my android device it show me "Web page not available" error.

I turn off all my firewalls.

what should I do to fix it ?

5
  • 1
    You cannot access a localhost website on an Android device that is located on a computer within your network. localhost only describes the current device even on Android. Commented Oct 1, 2013 at 16:36
  • 1
    Is your android device connected on same LAN ? Commented Oct 1, 2013 at 16:38
  • refer this ...stackoverflow.com/questions/10309049/….... Commented Oct 1, 2013 at 16:41
  • 1
    refer this also stackoverflow.com/questions/4779963/… Commented Oct 1, 2013 at 16:42
  • @mansoulx yeap , same Lan Commented Oct 1, 2013 at 16:44

2 Answers 2

4

You need to add an inbound rule in the firewall for port 80 (or whatever port you used for your website on IIS):

Go to Control Panel, Windows Firewall
Select Inbound Rules
Add a New Rule
    Select "Port" as a Rule Type
    Select "TCP and put "80" (and any other ports you want to open) in "Specific local ports"
    Select "Allow the connection"
    Select the network location where the rule should apply
    Give a name and an optional description

After that you should be able to access your site from other devices in the same network using http://computername (e.g. http://myhomepc)

However you might need to use the IP of the server machine with Android. It always seems to override its DNS entries using Google's servers. In this case try to modify DNS settings as explained here.

Sign up to request clarification or add additional context in comments.

Comments

0

I had the same problem and this is my solution without changing anything in FireWall or any other settings:

  1. Get the IP of the WebService deployed by IIS-Express (run IIS-Express): For this install the extension "Conveyor" in Visual Studio: Tutorial on Youtube
  2. To check if it is working open browser on your mobile and type in the IP shown in Conveyor: IP of WebService --> e.g. I typed URL: "http://192.168.178.51:45455/api/ToDo" to get the correct HttpGet from my Rest-Webservice
  3. To have it running in Android Studio I used a normal HttpURLConnection (Same URL also runs on Emulator!)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.