Accessing Grapevine REST Server over network - c#

I want to implement REST interface for my application. After some search, I select Grapevine (Got from stackoverflow itself.). It works fine. the problem is, the server accessible using localhost only. Even the server listening on 0.0.0.0:8080, the server is not accessible over network. Also only hostname localhost is working. Please help me to solve the problem or suggest another .net REST server.

If you can't reach the server from a remote machine, you are likely running a firewall that is blocking inbound traffic to the port you are listening on. Try opening the port on your firewall, and see if that works for you.
How to Open a Port in the Windows 7 Firewall

Use "+" as hostname and reserve the url by using the netsh utility:
netsh http add urlacl url=http://+:8080/ user=everyone
For more Information Notes On Using HttpListener

Related

Why is connecting from localhost by some libraries possible and by others not possible?

Both this library restup (written by tomkuijsten) and this library SimpleHttpServer implement HTTP server functionality and provide a clean API to embed and use it in UWP projects.
As stated in the first point of the FAQ here and explained here, restup cannot be called by the local machine (I tried even to run a virtual machine, setup a network using a virtual network adapter, but in vain).
But the question is, why is it then possible by SimpleHttpServer!?
Firstly the network socket of the server can be bound to either 0.0.0.0 (All), or explicitly to 127.0.0.1 (localhost), or the IP address of network card eg 192.168.0.2. Secondly HTTP/1.1 requires the host entered into the url to be passed as a header to the server. So either your request isn't sent to the right IP address, the server is rejecting the request based on the Host header, or some other firewall issue is blocking the request.
Restup is using a StreamSocketListener and SimpleHttp is using TcpListener. This would be why the one works locally and the other doesn't.

VPN / SignalR not working together. what can i do?

Have a server with a public IP address and windows server 2019. configured a VPN and when I try to access it through the VPN, signalR is not working.
if I access it through the public IP address it works.
I've got the firewall in off position.
if I go through the VPN it doesn't work.
more information:
all files are in the webserver (js )
doesn't give any error
I cannot see in Fidler anything strange.
VPN don't provide internet access.
See if the ports signalR is using are not blocked in firewall or VPN

Can you run a client application and a server application on the same host machine

I have a synchronous TCP server and client application the works absolutely fine on two separate host machines.
What I'd like to know is what IP and port do I bind the server socket and the client socket to when the applications are both running on the same host machine.
I can't find any solid information on Google about this.
When I try and use my network IP which was 192.168.0.32 I get an error that says the Host actively refused the connection.
I cannot find any reasonable information about this error.
Can I listen and send on the same Port?
What IP address should I use to bind the server and the client, when both applications are running on the same machine?
Thanks for your time.
In order to run both client and server applications on the same host you should bind your server socket to localhost (you can actually write "localhost" it's a preserved word or 127.0.0.1 ) and address it from the client as well.
Localhost allways refers to the computer you work on.
If you'd like to access your server from a machine which is outer to your local network using your network ip you've mentioned, you should first search for "IP FORWARDING" option in your router settings and forward incomming requests to the machine where the server is running on.
Or (my favourite) use the great IP TUNNELING service of ngrok. You can find it here https://ngrok.com/
good luck.
So the answer to this question is that I must bind to my loop back address with separate ports for the client and the server !!
The IP address could be the loopback 127.0.0.1 for both, or your IP address, I don't see why it would not work.
The port on the other hand has to be the same for it to work, assuming the client application doesn't also listens to the port that you "bind" it to.
You have to tell the server on which port it should listen. The client then has to send data on the same port for the server to get the information.
This example should get you going: https://www.codeproject.com/Articles/1415/Introduction-to-TCP-client-server-in-C

HttpListener not receiving remote requests, even with the firewall down and all prefixes registered

I've written a server using HttpListener that works perfectly well for requests sent from the same computer, but doesn't even receive requests sent from a remote machine. I've tried using (including registering with netsh) the following prefixes: http://*:8080/, http://+:8080/, http://localhost:8080/, and the specific IP address of the host computer followed by port 8080. (I also made sure no other applications were using 8080.) I opened up the appropriate ports in the firewall, and when that didn't work, I turned off the firewall just to see if it was a firewall issue and that also had no affect on the problem. I have no idea what to try next, please help!
Also, the machine running this web service is a Amazon Web Services Microsoft Windows Server 2008 R2 with SQL Server Express and IIS EC2 instance.
If you are using AWS free tier EC2 instance, adding the given public elastic IP as the prefixes will not work for you even after you have the local firewall port and ports in security group opened. The HTTPListener needs to be bind with the public DNS provided by AWS. Then only it will work.
For future users, the solution in more detail was to add an Inbound Custom TCP rule that included port 8080 in the 'Port range:' to a Security Group used by my EC2 instance.
thanks to #shashankaholic for pointing that out

Port forwarding on Windows 7

How do I redirect an incomming request on port xxx to localhost:yyy on windows 7?
Development Server (vs 2008) only allow access from localhost which isnt good enough. I need to test my app from various computers.
Thanks for the suggestions guys, although I found the answer myself.
I downloaded Microsoft SOAP Toolkit version 3 and started MSSoapT, created a formatted trace listening on port 8080, forwarding to host: 127.0.0.1 port: 3804. My problem was I used "localhost" and not "127.0.0.1".
Now every request made to my development machine from other computers through port 8080 will be redirected to port 3804 where ASP.NET Development Server is statically set to listen when debugging VS.NET webapps.
On the command prompt.
$> netsh
$> interface portproxy
$> add v4tov4 listenport=xxx connectaddress=127.0.0.1 connectport=yyy protocol=tcp
See: http://technet.microsoft.com/en-us/library/cc776297%28WS.10%29.aspx#BKMK_1
If this really is for some testing, you could create a server which listens on a port, and when it receives an incoming connection spawns a thread that opens a connection to the actual local server, and afterward just waits for data to come in either end and shuffle it along to the other end. If either socket closes, the worker thread would terminate. This is obviously not a scalable solution, but for testing it should easily do the trick.
Not really sure what you are looking for. However port forwarding will be relevant when you have a router in place and you need to explicitly forward a request on a specific router port to a specific IP and port on a LAN computer. If you want to access the web server from other LAN computers on the same network then http://ip-address should just work fine. Also make sure that your web server is listening on the LAN IP and is not just bound to localhost.
I'm using windows 7 64 bit and couldn't get the Microsoft SOAP Toolkit to work on my machine for port forwarding and didn't like the free port forwarding software I found out there so I just changed my VS 2010 web app to use local iis, I know this doesn't help people running 2008 but it works if you have 2010... Here's a screen shot of my change: I'm doing this for testing on the iPad...

Categories