Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Phone 8 Emulator: Access localhost

I created MVC4 Mobile Application using VS 2012 default template. It's working fine in desktop browser using http://localhost/mvcapplication1/ but when I tried running the same app in WP8 Emulator browser it's not working and showing message "We're having trouble displaying this page". I also tried with IP address (127.0.0.1) but still no luck. Please tell me how can I connect to localhost using WP8 Emulator browser?

like image 729
brijshah Avatar asked Oct 30 '12 23:10

brijshah


People also ask

Can I access localhost from Android emulator?

If you're using Android Studio to run the emulator, then localhost of your host computer will be mapped to the IP address, 10.0. 2.2 , inside the emulator. If you're using other programs to run the emulator, then you may need to consult the documentation associated with those programs.

How do I Preview localhost on a live mobile device?

On your mobile device's browser (any will work), navigate to http://<Local IP Address>:<port number> . For example, if I was serving on localhost:8080 and my local IP address is 123.45. 67.890, on my mobile device's browser I would navigate to http://123.45.67.890:8080 .

How do I access my localhost?

Usually, you can access the localhost of any computer through the loopback address 127.0. 0.1. By default, this IP address references a server running on the current device. In other words, when your computer requests the IP address 127.0.


2 Answers

The Windows Phone 8 emulator is actually a full virtual machine with its own internal IP address.
Therefore, localhost means the (virtual) phone, not your PC.

To connect to the host PC, you need to enter its internal IP address.

You also need to configure IIS Express and your firewall to accept connections from other computers.

like image 146
SLaks Avatar answered Sep 22 '22 13:09

SLaks


I was looking for an answer for this too and found out there is now an official answer from Microsoft at:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580%28v=vs.105%29.aspx

like image 27
jumantyn Avatar answered Sep 24 '22 13:09

jumantyn