I Have two different projects:
My goal is simple:
Use the WP8 Application running from a real device, to access (using HTTPClient) the WebAPI controller while it is deployed to the Azure Emulator.
What DO work is:
IIS Express
(Without Azure), and the IIS Express
settings are changed following this article.As far as I understand, the problem is that the Azure Emulator is configured to listen on IP address 127.0.0.1, which is not accessible from outside the localhost domain.
I found this post that offers a solution to this exact problem, but trying to follow it results in an Unknown Exception while trying to deploy to Azure Emulator.
Is it really impossible to locally test WP8 application that communicates with Azure Cloud Service?
I figured out how it is possible to have a Phone Emulator or an attached physical Windows Phone device communicating with the Azure Emulator.
For other developers struggling with the same requirement, here are the steps required for it to work:
"C:\Program Files\Microsoft SDKs\Windows Azure\Emulator\devfabric\DevFC.exe.config"
for editing."VipPoolStartIPAddress"
and "VipPoolEndIPAddress"
to your hosting machine IP (e.g. 192.168.1.100)"C:\Program Files\Microsoft SDKs\Windows Azure\Emulator\devstore\DSServiceLDB.exe.config"
and "C:\Program Files\Microsoft SDKs\Windows Azure\Emulator\devstore\DSServiceSQL.exe.config"
for editing.services
section in both of the files to use hosting IP.Windows Azure storage emulator
setting):
Role
(under "Roles" folder in the solution explorer) to enter it's Properties
page. Click on Settings
tab. Make sure you edit the Local
settings (Select it on Service Configuration
selection box).accounts
section in DSServiceSQL.exe.config
Enjoy!
You don't need any external app to do this. Try port forwarding using the following:
Run your application in Azure emulator and then find out its IP and Port by right-clicking the IIS Express icon in the system tray (say 127.0.0.1:81)
Now choose a port to listen to (say 8088) and forward its incoming requests to your application by simply executing the below command in an elevated command prompt:
netsh interface portproxy add v4tov4 listenport=8088 connectaddress=127.0.0.1 connectport=81 protocol=tcp
If the firewall is running and your chosen port is blocked, then open the port (8088 in this example) by adding an inbound rule to Windows Firewall.
Now browse using your Computer IP, like 192.168.0.100:8088, and now you should be able to access your application. And this can be used through your WP or Cordova (mobile) app to test locally. Hope this helps.
(If you want to remove the port forwarding, then just use the delete switch of the netsh interface portproxy command.)
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