In this short Jumpstart, I am going to show on how to access IIS Express (Visual Studio Development Server) Localhost URL outside the development machine on any other device which is connected to the same network as of Development machine. This would help us in saving lot of time in testing the application on different devices with different form factors. We often use emulators to test the behavior of our application, though this approach would give prospective results, one cannot trust emulators with 100% confidence (take an example of File upload). If there was a way to directly access the application (without hosting it, directly from development server) on the remote devise of interest, we can test and be confident about application usage.
Credit goes to Ionut-Cristian Florescu for writing a Node.JS Module which will create a proxy port to transfer all external HTTP traffic to the IIS Express URL.
Step 1 : First create a simple ASP.Net MVC 4 Application in Visual Studio 2013.
Step 2 : Download and Install Node.JS. To make sure Node.JS installed properly. Open CMD ( Windows button + r –> cmd). and type npm. You should see something as shown below.
Step 3 : Install IISExpress-Proxy NPM Module using following command.
npm install -g iisexpress-proxy
Step 4 : Find the IIS Express port on which ASP.Net MVC application is running (right click the MVC project and select properties, then navigate to Web tab).
Step 5 : Create a proxy port so that all the HTTP traffic to the IIS Express Localhost URL will be served.
iisexpress-proxy 58033 to 3001
Note the Ethernet IPAddress through which we can access the localhost URL.
Step 6 : Access the URL on any other devise which is connected to the same network.
Points to be remembered :
1. Make sure you run the application in Visual Studio, before creating the proxy port.
2. If Visual Studio code is not running in IIS Express, then you may not be able to access the application.
To give you the feel on how to access, I am using WebMatrix’s IOS Emulator to show the output.
That’s it, we are done with this small jumpstart. Enjoy Coding and stay tuned!!!