views:

114

answers:

3

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.

A: 

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.

Sabeen Malik
Say I have a WEB application developed in VS.NET running in debug mode. This will start an application on windows called ASP.NET Development Server and will listen on, say, port 3804. Now I need a proxy/port forwarding tool of some sort to accept incomming requests on a different port, say, 8080 - and fire the request against "localhost:3804". This will force Development Server to 'think' the request came from localhost and not a remote machine. Problem is that ASP.NET Development Server only allows requests that originated from the same machine as it is running.
Cant you use just run your web app on IIS ?
Sabeen Malik
If you cant install IIS on Windows 7, then probably it would be easier to install Apache and run it in proxy mode. Where Apache would serve the content from http://localhost:3804. You can easily setup Apache on window and then look into the mod_proxy module.
Sabeen Malik
While developing and debugging Im testing through a mobile device also connected to my LAN, so I dont want to waste time deploying the app all the time.
Thanks, I trust your suggestion would work - It does require alot of effort to setup though. See my answer below.
great that you figured it out :)
Sabeen Malik
A: 

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.

Yuliy
Yea, but as a developer I am lazy. So I was wondering who wrote that tool and where I can find it ;-)
+2  A: 

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.