Let me explain the scenario. I am a novice .NET developer. I have picked up the .NET framework a couple of weeks ago. I am well versed in PHP and Python and have worked on the LAMP stack so far. I use Pay monthly websites, cause as a developer I know what’s the best way I could save a ton of money and make more profits. I am relatively new to the Windows and Visual Studio environment. I have tasted many technologies and I love experimenting. Web Application Development being my primary concentration, I decided to give Visual Web Developer a try.
I have Visual Studio 2010 Ultimate installed on a Windows 7 Notebook. I actively develop PHP MySQL apps on the same PC. I am a BTCL ADSL subscriber and have a Belkin N Series router. With my WAMP Server, the apache can listen to my ISP IP address and anyone can visit my local web apps over the internet using that address. That’s pretty cool! Since I am a beginner, I decided not to install IIS and stick to the development server of Visual Web Developer (or VS). For security reasons, the dev server listens only to internal ports and refuses remote connection. Duh! I don’t want to pay for Windows hosting just to show off how fast I am learning!
After browsing the internet for a while, I came across a tool :- SPI Port Forward. It can forward any ports on the machine to any other ports on another host. Pretty cool! Remember, localhost is a host that has an IP address 127.0.0.1. This IP address is internal, that is available only to your machine. So, we can fool VS by forwarding any incoming connection to a port on localhost. VS will think that this is an internal connection. 🙂 Yeah, it’s that easy!
So what do we do? We download the stand alone SPI Port Forward Utility. We map a port on our pc (say, 3500) and map it to the VS dev server port. But, wait! VS uses random ports for running the app. How do we forward the port? That’s easy. Just go to the project properties, go to the “Web” section and define a fixed port under the “Server” section. Cool!
Now, note that, you can not forward port 3500 to 3500. After all its the same machine. So I launch VS on port 8000 and use the port 3500 for accepting incoming connection. By the way, since I am inside another Wireless network, I had to setup the router to forward all ports to my Notebook PC at the first place. That’s it! We’re done.
What happens now? When someone visits your ISP IP address, the request is made to your router. Your router forwards it to port 3500 to your machine. Your machine forwards it to the internal port 127.0.0.1:8000 where the VS Dev server is running!
Now you can show the world off your .NET skills! Have fun 😀