Cannot call localhost deployed on laptop from Android device - c#

Here is my situation:
On my laptop (running Windows 8.1), I have deployed a Web API (written in C#) to my
localhost. I can access this service from laptop browser. The
address is http://localhost:8089/api/... blah blah
My laptop and my Android device are connecting to the same WiFi network, because I'm testing this at home.
I added an Inbound Rule on Firewall for port 8089.
My laptop IP is: 192.168.0.8, but when I call http://192.168.0.8:8089/api/... from my Android device, it said Connection refused.
What should I do now to make my service available to my device? Thanks for your help.

Related

.NET Service System.Net.Sockets.SocketException: 'No such host is known'

I deployed a .NET Windows Service on Azure Virtual Machine running Windows Server with an opened port that allow me to connect to it, this service is like a server using socket. The problem is that when I try to connect from my PC to that hosted server it doesn't work and I get this exception: System.Net.Sockets.SocketException: 'No such host is known'. The port is opened and visible from my PC. Can someone tell me why I get that exception? If I run locally all works ok.
The Exception seems to be a DNS issue. I am not familiar with C#, from networking, you could check the followings on your side:
Windows service is running and the port is listening on the Azure VM.
The port is allowed for outbound traffic from your PC and Inbound traffic on your Azure VM. Check the VM firewall settings on both sides between your PC and Azure VM. Also, you could check the NSG settings follow this. You could use telnet vmpublicIP port on your PC CMD to verify network connectivity.
Verify your PC can resolve the address of hosted server if you connect it via its DNS name. You could use the NSlookup or DIG to verify this. If it's DNS issue, you also could add a line in hosts file (located in %WINDIR%\system32\drivers\etc on windows) mapping the hosted server's IP to a name.
Hope this helps.

Localhost webservice connection from android device

I'm developing an android app and writing web services for that app on C#. So I need to try my webservices in my app from android device. I guess, for try my webservices from device, need to put my local IP address to instead of "localhost". And for use my local IP, i need to install IIS. I install IIS and put my IP to instead of localhost. I set binding settings from IIS manager.
IP:192.168.XX.XX
PORT:49244
I can access 192.168.XX.XX/49244 address, but when I try to access my webservices,192.168.1.36:49244/Service1.asmx, I get HTTP not found - detailed error.
What I need to do for access my services, where is my mistake?

Communicate to PC over USB

How can I exchange data between my WP8 app and my desktop Windows app running on the PC that has the phone connected with a USB cable? On WP7, there was TCP/IP networking over USB connection. On WP8, it seems it no longer works.
On the device side, NetworkInterfaceList class lists the Ethernet adapter, however NetworkInformation.GetHostNames method says there is no IP address assigned to that NIC. Is there a way to assign an IP address to that NIC, and use it for phone-to-pc communication over the USB cable?
On the PC side, looks like the connectivity DLLs implement Smart Device Connectivity API. Where can I find Microsoft.Smartdevice.DeviceAgentTransport.dll for Windows Phone 8 platform?
Are there some other options?
P.S. I am not submitting anything to the marketplace, so private or undocumented APIs are OK for me.
I was just looking for this one myself and found a good resource over at msdn,
IP over USB. As long as you have the windows phone SDK installed you have everything.
Edit: A small update, it seems that the server code must be running on the device and the client on the host, but apart from that everything worked as expected.
Used regedit to add a new entry under HKEY_LOCAL_MACHINE\Software\Microsoft\IpOverUsbSDK and created values similar to other entries, just different ports.
It took a few seconds and a refresh of regedit for IpOverUsbEnum.exe to display the new service.

Windows phone: cannot connect to a computer using socket

Situation: there are two programs - client and server.
Server is working on my computer, client program is working on windows phone.
Server is listening for incoming connections ant receive data. Windows phone creates a socket(tcp connection) and sends data.
If I connect win-phone to my computer using USB cable, all works: connection establishes and data is transferring.
But when I create an "infrastructure-network" using the program "connectify", or connect to real wi-fi router (computer and win-phone both are connected to the same network) it is not working. I disabled windows firewall, but it is still not working.
How can it be explained? Where is the problem?
The problem was in ip address string in python server code.
I used "127.0.0.1" instead of "localhost" :(

10013 error (AccessDenied) on Silverlight Socet application

I am writing silverlight 3 application which is working on network.
It works like client-server application. There is WinForm application for server and silverlight application for client.
I use TcpListener on server and connect from client to it with Socket.
In local network it works fine, but when I try to use it from internet it don't connect to server.
I use IP address on local network and real IP with port number for internet version.
I get error 10013 AccessDenied.
Port number is correct and access policy exist.
Firewall is turned of.
Where is the problem?
Thanks.
Have you tried to check the general availability of the connection from your machine to the Internet server with telnet ?
The problem was that computer, where hosted website hasn't real IP address, and I couldn't connect to it from internet. I added Real IP address and everything works fine now.

Categories

Resources