This problem has been plagued for a long time, and the answer was found to be biased.
In fact, connecting to Web services is not a problem for WP7, because the network used by WP7 is the network of the Local Machine. However, in the WP8 simulator, pure virtual machines and independent devices have their own network connections, be treated as a virtual machine.
Apps that target Windows Phone OS 7.1 can connect to the development computerLocalhostBecause the Windows Phone 7.1 emulator uses the network connection of the development computer. however, the Windows Phone 8 emulator configures itself as a separate device on the network. as a result, an app running on the Windows Phone 8 emulator can't connect to the development computerLocalhost.
There are a lot of answers to this problem on stack overflow. This is actually a basic common problem for WP8 development, So Microsoft also provides a solution.
How to connect to a local web service from the Windows Phone 8 emulator
However, this solution is too complicated. It is easy for me to explain it.
There are also many such problems in stack overflow. You can directly change localhost to the local address, but note that you can open the firewall.