5

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 ?

Mas Jamie
  • 159
  • 2
  • 10

2 Answers2

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.

Community
  • 1
  • 1
Ziad
  • 1,036
  • 2
  • 21
  • 31
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!)
PhiWue
  • 1