In today post we will talk about a simple problem that many developers have when they start to develop an application for Windows Phone.
Almost any Windows Phone application needs to communicate with a backend or with a website. In this cases, the backend can be already developed or the develop will write it from scratch. In both cases there are times when you need to host your backend on your local machine and test different cases.
In that moment you will observer that you cannot access your local machine and services from the emulator. This is happening because the emulator runs in another network. Also, you cannot access a service using localhost. The localhost in the emulator will be the emulator itself.
There is a very simple solution for this problem.
1. Get the IP of your machine (ipconfig)
2. Update applicationhost.config file of IIS or the configuration file that has the binding configuration
File path: c:\Users\[userName]\Documents\IISExpress\config\applicationhost.config
Enjoy!
Almost any Windows Phone application needs to communicate with a backend or with a website. In this cases, the backend can be already developed or the develop will write it from scratch. In both cases there are times when you need to host your backend on your local machine and test different cases.
In that moment you will observer that you cannot access your local machine and services from the emulator. This is happening because the emulator runs in another network. Also, you cannot access a service using localhost. The localhost in the emulator will be the emulator itself.
There is a very simple solution for this problem.
1. Get the IP of your machine (ipconfig)
2. Update applicationhost.config file of IIS or the configuration file that has the binding configuration
File path: c:\Users\[userName]\Documents\IISExpress\config\applicationhost.config
<site name="MyApp.Site" id="99">
<application path="/" applicationPool="FooIntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\App\MyApp.Site" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:8080:localhost" />
<binding protocol="http" bindingInformation="*:8080:110.121.21.359" />
</bindings>
</site>
3. Specify in the WP code to use your local endpoint using computer PCEnjoy!
Thanks for sharing userful information. Keep it up!
ReplyDelete