I'm glad you came here to resolve web services issues in the Windows Phone 8 emulator. Let us discuss it. Previously in Windows Phone 7 in OS 7.1 a local web service was connected and consumed using http://localhost:port. But in Windows Phone 8 things have changed. The Windows Phone 8 emulator works as a separate device like another PC. We are well aware of the fact that localhost does not work on two separate machines. That is the basic reason why the Windows Phone 8 emulator generates an exception.

emulator generates exception

Now, the real part of my article starts here.

Prerequisites

  1. Create a firewall exception to allow World Wide Web Services (HTTP) using the firewall.

  2. From the Windows Start Screen, search for Turn Windows features on or off. Click to run the program.

  3. In the Windows Features dialog box, expand .NET Framework 4.5 Advanced Services, then expand WCF Services.

  4. Under WCF Services, check the box next to HTTP Activation. Click OK to install this feature.

    http activation

The following describes how to remove this exception and how to consume local web services.

Solution:

Note: It is better to allow inbound rules for private and domain.

Everything goes fine here but the problem in Windows Phone 8 is this that consuming WCF is not so much of a charm in WP8.

Even if you do the entire procedure, you will still fail. Here is the solution to the problem.

Whenever you use your IP address you consume WCF. First register it.

CMD provides a native command that can be used for registering the URL for caching.

If you want to read more on the Netsh command, here you go!

The next step is to deal with the bindings for “applicationhost.config”.

Note: Use the respective port number instead of 60661.

I hope you enjoyed this simple tutorial to run local web services on your Windows Phone.

Happy coding!

Helping Note:

Inbound Error:

If you are getting an Inbound error then that is basically due to firewall settings. To resolve this error use the following procedure.
  1. Go to Windows Firewall and select Advanced Settings -> Windows Firewall properties.

  2. Domain Profile -> Inbound Connections -> Allow.

  3. Private Profile -> Inbound Connections -> Allow
Press OK

References: