views:

103

answers:

3

Hi there, I'm trying to develop an iPhone application to consume a Web Service written in C#. I want to be able to access the web page through the localhost on my PC (http://localhost:54053/Service1.asmx) so I don't have to push the Web Service live just yet. Any recommendations on how to do this?

Thank you very much.

A: 

First make it work like

http://localhost/Service1.asmx

To do this you have to make your web service work within local IIS.

Then find the Ip of your local machine.

www.whatismyipd.com

Then be sure that the port 80 is open (If you're not sure how to do this try switching the windows firewall off)

Then call the web service with your IP address as: http://xxx.xxx.xxx.xxx/Service.asmx

Aykut
No need to run it thru IIS. It's all about having the port open that be 80 or 54053.
Mikael Svenson
54053 won't work because that's a Cassini port. Cassini binds directly to 127.0.0.1 and is not accessible remotely in that fashion.
Joel Etherton
A: 

I assume you either have a phone or emulator running on a mac. This means they are not on the same machine as your webservice which is developed in asp.net.

You need to change "localhost" to an IP your computer can be reached at. You can do this by running "ipconfig". If the mac is on the same local network as your service this is probably 192.x.x.x something or 10.x.x.x something.

Eg.: http://192.168.1.20:54053/Service1.asmx would be the address on my local network.

If you need to use an internet address it's much more complex, since you most likely have to open firewall ports and do port forwarding at a gateway/router.

Mikael Svenson
+1  A: 

You will have to use IIS on your development machine. The built-in Cassini server binds directly to 127.0.0.1 and is only accessible locally. To access it from a remote device, you need to set up a host in IIS. Cassini has a limitation to 127.0.0.1 and is not accessible remotely.

Once you have a website set up to answer to an IP address that is not 127.0.0.1, and it's configured to serve your new web service, then you can use the IP address to get to it.

Joel Etherton