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...
Related
I connected two laptops together with a wi-fi modem.
Laptop1 got the IP 192.168.0.20
Laptop2 got the IP 192.168.0.21
I launched an ASP.Net Core web application on Laptop2 on port 44382.
I turned off both laptops' firewalls.
The result of ping 192.168.0.20 from laptop2
The result of ping 192.168.0.21 from laptop1
When I call my API from the laptop2(localhost) there is no problem and I see the result
The problem is when I call API from laptop1(another laptop), after a long time I see this
I can't find what my problem is.
You're most likely using IIS Express, which doesn't automatically bind everything the way you need for remote access. This answer breaks down what you'll need to accomplish that fairly well, but you may just want to look at installing IIS.
Make sure door 44382 is open in the firewall.
Create new rule in/out for port here (advanced configs of firewall)
I have a self-hosted C# Windows Service written with VS2015 that includes SignalR and uses version 2.2.2 and jquery 3.2.1. It works fine for all the systems that use a "real" (addressable) IP address. But the computers that are behind a NAT cannot. They get a "SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. " error. If you use the URL http://servername/signal/hubs", you get a "Server took too long to respond" error. (clients with real IP's see the source).
Windows Firewall is disabled on the clients. However, the SignalR service is running on 80 and 443 so I wouldn't think that would be a problem. Anyway, I'm so confused at this point, I don't even know what code to post.
What can I check, do, post to figure out why this is not working for NAT'd clients?
EDIT: I had some other people test this and found two of us that use U-Verse had the connection problem. However, the people in the main office who are on the corporate NAT were connecting. So maybe this is something in the U-Verse router/firewall that's stopping the connection. But why would it block ports 80 and 443? Does SignalR do any out of the ordinary on a connection?
EDIT #2: I ran Wireshark on the server. It receives the request from the NAT'd client but keeps retrying to send the response to port 80. I'm not really good at understanding Wireshark or what to look for. Obviously, something is not working properly.
This was quite stupid on my part. I was using a server solely for SignalR that did not have IIS installed... and apparently you need to do that in order for ports 80 and 443 to be open in the firewall. The firewalls on all 18 servers are set to allow access from any of my domain's IP addresses. When using NAT, it uses a completely different IP and therefore was stopped. I opened 80/443 on the SignalR server and all is well... D'oh!
Having some trouble with websocket-connection within the local network.
Scenario:
For my laptop (Win7) I've written a service which opens a websocket-server to port 2014. Because websockets aren't enabled by default for windows 7 I'm using the supersocket library ( http://www.supersocket.net/ ).
For the Client I've written a android app with sencha touch and Phonegap. To enable websocket- support for android devices with version lower 4.4 I've integrated the phonegap websocket- pugin.
The reason is to open a websocket-connection between the android device and the laptop to control the laptop by the android app. Both devices are members of the same local network.
The problem:
After installing both applications (windows service and android app) I've tried to connect my android device with the service from the laptop. First step is to open the connection on the client:
var connection = new WebSocket('ws://192.168.178.21:2014');
But in the event-logs of my windows service there is no successful connection logged.
After that I opened the browser of my laptop and tested the same code - successful. Client and Server could communicate with each other.
So I've tested the websocket-support on my android device: changed the websocket-url to
var connection = new WebSocket('ws://echo.websocket.org');
and could connect to the server -> Android websockets are okay.
Third step was to disable my firewall and check the connection with Wireshark:
Screenshot:http://www.directupload.net/file/d/3710/y9t79npy_png.htm
192.168.178.21 -> Laptop IP
192.168.178.23 -> Android device IP
So it seems that the packets reach my laptop but not the service. Additional tried to use the secure wss:// protocol - no victory.
Don't have any ideas anymore. Would be a pleasure to get some help :)
So it seems that the packets reach my laptop but not the service.
Could it be that the server is binding to a specific IP address or hostname? Often servers will implicitly bind to all interfaces, such as 0.0.0.0, but sometimes they bind to one specific interface. If that happens, then you need to connect to that same interface.
You said your client is connecting to ws://192.168.178.21:2014, but could it be that the server is binding to 127.0.0.1 or localhost or your hostname, and therefore doesn't see the request? That could explain why the laptop received the request, but not your service.
Then again, you said you tried it from your local browser, and it worked. Did you use the same IP address, or did you use 127.0.0.1 or localhost? Assuming you used the same IP address, 192.168.178.21, then that would indicate it's not the bind issue I described.
Sorry, that's all I can think of at the moment.
After some time i´ve found the solution:
Had to add the firewall rule to the public firewall options.
Thanks for your help:)
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
I am thinking about writing a client server app using sockets in c#. My question is, if the server is behind a router and upnp is enabled, once the server starts listening does upnp automatically forward data incoming to that computer if it is destined for said port? I don't want the user to have to start forwarding ports, I am hoping my server app can be zero configuration.
Thanks in advance.
I worked on a uPNP tool a little while ago for a work application for file sharing across multiple sites.
I can confirm that during the port configuration via uPNP, that you do indeed specify which port and end point you would like to listen.
If uPNP reports back OK. All requests to the port will be forwarded to the passed end point.
I will find the class I made \ modified and give it as an example shortly....