- This article resolves the issues that come across when we try to consume a web Service from our Windows Phone 8 Emulator.
When you create a WCF web service in Visual Studio, by default the service is hosted in IIS Express and only accepts connections at http://localhost/. Apps that target Windows Phone OS 7.1 can connect to the development computer as localhost because the Windows Phone 7.1 emulator uses the network connection of the development computer. The Windows Phone 8 Emulator, however, 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 computer as localhost.
All the relevant Details about this can be found at the following link
But the Problem is that this solutions too gives problems and the emulator won’t consume a web service, just yet,
but fortunately, one of our brilliant interns here at MIC Lahore, Saad Mahmood, has come up with a solution that can help resolve the isssues.
When you intend to consume a web service, you generally come across the following exception,
for a resolution,
- Create a firewall exception to allow World Wide Web Services (HTTP) through the firewall.
- From the Windows Start screen, search for Turn Windows features on or off. Click to run the program.
- In the Windows Features dialog box, expand .NET Framework 4.5 Advanced Services, then expand WCF Services.
- Under WCF Services, check the box next to HTTP Activation. Click OK to install this feature.
- On the Action page, select Allow the connection. Then click Next.
- On the Profile page, select Private and, if applicable, Domain. Do not select Public. Then click Next.
- On the Name page, type a name for the rule – for example, Local web service for testing. Then click Finish.
Everything goes fine here but the problem in windows phone 8 is this that consuming WCF is not that much charm in WP8
you do all steps but still you fail, here is the solution to the problem
When ever you use your ip address you consume WCF first register it .
CMD provides native command that can be used for registering the URL for cashing.
- Run CMD as administrator and type this command
- Netsh http add urlacl url = http://<your ip> : <port>/ user = everyone
- This will result in “Reservation successfully added”
You can Follow the steps in the Blog Post by Saad Mahmood on the following Link