Work with Web API and Windows Phone - windows-phone-7

I am developing a solution that is composed of two elements: a web server, which publishes some REST services, and a mobile client, which consumes those services.
To implement the REST services I have used the Web API technology.
When I start the web project in debug, everything works fine. I can use the services by pointing to localhost:63954/api. A weird fact: if I change "localhost" with "127.0.0.1" or with the LAN address of the machine, 192.168.xxx.xxx, the server does not answer anymore!
Then, when I start the Windows Phone client, which runs in a virtualized emulator, it fails to connect to the web server! Even if the two components are running in the same machine.
Obviously, in Windows Phone I cannot use the "localhost", since the localhost of the phone is the phone itself. So I'm trying to use the 192.168.xxx.xxx address which is the address of the machine that is running the web service. But the mobile phone emulator fails to reach the webservice.
I need to run the Web Server in Visual Studio 2012, since I need to debug it, and to make it reachable from the Windows Phone Emulator, but I do not know how to do it. Can you help me? Any idea?
Thank you so much,
Riccardo.
EDIT: By following the link found here (Binding IIS Express to an IP Address) and by turning off my firewall I can run the web application outside VS12 and I can make it reachable from other pc in the network, and so also from the WP emulator. This could be a work-around, but I cannot debug the REST service in VS in this way and this is not good...

The Windows Phone 8 emulator works as a separate machine on your network, with it's own IP address and configuration. Therefore, for the emulator to be able to access your service you will need to make sure that the port you are trying to access is open for inbound connections.

As you mentioned the windows phone is running seprate in your client machine,One way of solving this problem is ,Binding your machine's Ip address to the Web Api,SO the Web api can be accessed using the Machine's Ip address.You can Bind the ip address to the project by using Microsoft Webmatrix.
So,You can access the web Api using the Ip address.Hope this helps.

Related

Apple passes development environment

I am trying to understand how to work with apple passes whilst using localhost. I am using Android Usb debugging so I can visit my website served on localhost from my phone. I have also setup the signing, compressing and installation of the passes.
What I don't understand, is how to debug communications between the installed pass and my server. I don't seem to be receiving requests from the pass once it is installed. Is this because I am using localhost? I inserted localhost as the web service in the pass.json file used to generate the file. My problem is understanding how to debug the problem as I am getting no feedback to work on.
Localhost won't work as the device will view localhost as itself, not as your computer.
To work locally:
connect your phone and computer to the same wireless network
allow http in the developer menu of your iPhone (otherwise the pass will be rejected for not having a https webServiceURL)
use http://computerIp:8080/ as the webServiceURL
serve your web service on your computer on port 8080
For feedback you can view your device logs in Xcode or in the OSX Console application.

How to bind IIS Express so it handles requests made to ethernet adaptor?

I'm sharing a wifi connection from a Windows computer to a Mac through their ethernet adaptors, and I'm trying to setup IIS Express so it listens for requests being made from my Mac to the Windows ethernet address on port 64550. I'm getting a status 503 Service Unavailable error on Mac when attempting the request, however.
I'm not really sure what to bind IIS Express to. I've tried *:64550:localhost, *:64550:127.0.0.1, and *:64550:<ethernet-adaptor-address> with no luck.
I should note that I have also setup the advanced internet sharing settings in Windows to allow access to the service, where the internal/external ports are set to 64550 and each of the ip addresses just mentioned I've tried using as the service host ip, so I believe there should be a firewall rule created allowing access.
I should also note that I'm able to successfully make requests to IIS Express with a different network configuration, where both computers access internet through same wifi router and the router forwards requests to 64550 to Windows computer.
I'm using Windows 10, Mac OS 10, and Visual Studio Community 2015 (.NET Framework 4.6) with IIS Express version 10.0.10557.1000.

Access to a self-hosted WCF service on azure virtual machine over the Internet

Actually the question is kind of duplication of the following one Unable to access a locally hosted wcf service over the internet but with only difference that the service is hosted by a windows service on Azure Virtual Machine.
I can access the service on the machine and I have added an endpoint to the service port at Azure Configuration console, but still cannot access the service over the Internet.
The error message that is not possible to set up connection.
Is my scenario technical possible on azure? if yes - what is done wrong?
The answer to my question was pretty straightforward. Although I opened my endpoint in Azure Management Console the port was blocked by the virtual machine firewall (windows firewall). After setting in- and out- tcp port rule, the problem had gone.

Windows 7 running as server

I'm developing a program using Windows 7. There are WCF services (soap, rest) that are used by currently by Silverlight but very soon I'll start development of the mobile application that would make use of these services.
On day to day basis I use Mac and Apache to host my website, but during the development of this program I would like to use IIS7 to put my services online. I have absolutely no problems to access all the services via localhost but as soon as I'm trying to connect through the internet I get "The connection has timed out".
I'm sure that my router is configured right as it works perfectly fine when I'm on Mac OS, but it looks like Windows simply blocks incoming connections from outside; I cannot even connect from another computer on the same network.
So is there a way of using Windows 7 as server with IIS7 or is it only possible with Windows Server? I know it might be like enabling/disabling one setting somewhere but I just cannot find it.
Please help.
By default, the Windows 7 firewall doesn't have a port 80 exception for IIS, you will need to either add an exception or disable the firewall to be able to connect from another machine.
Windows has a built-in firewall that is probably blocking the connections. Type "firewall" into the control panel search box to find the settings to allow stuff through/turn it off completely.

IIS 7 and ASP.Net MVC issue

This is a bit complex - so here we go.
I am developing a mobile web application using asp.net mvc and I need to test it locally on my iPhone. So far I have the first iteritaion of the site running on my local dev laptop. I created a virtual dir for the site under IIS 7 on the same machine. I deployed the site to that folder from VS2008. I open a browser and entered "" and the site cam up just fine. I am runnig a home network with locked down WIFI and both the laptip and my iPhone are on the network. So now I want to test with the iPhone but the site won't come up when browsing to "". I have another machine that is also on the network and I get this error message when attempting to browse to the site:
"Website (laptopname) is online but isn't responding to connection attempts"
I have a feeling that this has something to do with IIS setting and \ or application pools but have not been able to find anything relavent goolging. Any help appreciated.
There are some possibilities:
iPhone is not able to resolve your laptop by name. Try using the IP address of your computer in the URL instead.
The firewall on the laptop is blocking inbound connections from other machines. Check your firewall.
The IIS Website is configured with a host header localhost so it won't respond to requests to other hostnames. Check the binding for the Web site in the IIS Manager.
To eliminate possible network issues, you can create an ad hoc WiFi network on your PC and connect to that network to test.
Check that Allow Anonymous Access is set for the site
I suspect you are not alone, as I had this exact problem. I developed a small port opener I called "SharpProxy" that may make your local testing much easier.
Overview and instructions:
http://www.codefromjames.com/wordpress/?p=97
It's open source! Get code here: https://github.com/jocull/SharpProxy

Resources