I’m developing an app with an Android-ian friend. When co-developing some of the features, we’ve found it critical to be able to easily access the development stream of the services, which I’m building with Asp.Net’s WebAPI. Here’s an easy way to configure your IIS Express instance to allow outside traffic.
The out-of-box experience for IIS Express is to have all web traffic closed to clients not residing on localhost. This is a great security practice, but not great when you’re trying to share a site or service. Configuration of IIS Express is also non-evident; the little UI you do have exposes no way for you to actually modify the section of config that allows access.
To enable access outside your box, you need to create a virtual directory for your app and edit the applicationhost.config file located My Documents\IIS Express\config.
In Visual Studio, double-click on your project properties and open up the Web tab. Scroll down to the section where you can select the server and make sure it’s on IIS Express. Finally, click on the Create Virtual Directory button. This creates an entry in the config file.
Now, open up that config file (again, it’s in My Documents\IIS Express\config) and find your newly created site. Update the config section so that it looks something the the following by adding a second binding.
<site name="MySiteOfAwesomeness" id="13"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="C:\dev\MySiteOfAwesomeness\MySiteOfAwesomeness" /> </application> <bindings> <binding protocol="http" bindingInformation="*:4111:localhost" /> <binding protocol="http" bindingInformation="*:4111:192.168.100.101" /> </bindings> </site>
Note that instead of localhost you can use your computer name or your IP address.
Finally, you’re going to need to open up that port through whatever firewall you have. For me, I used Windows Firewall with Advanced Security (much better than the Marginal Security version) and added a rule to allow traffic on my project’s port.
Hope this helps someone, and, hey, be nice to your Android friends, they might be somebody’s brother.