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?
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.
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 .
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With