Wednesday, December 23, 2015

Publishing a ASP.NET 5 Web-Application to IIS Locally

I ran into few issues and discovered some kinks in publishing the new ASP.NET 5 Web-Application to an Internet Information Services (IIS) on the local box and then accessing it from other devices on the same network.

While there may be a number of different ways of doing this, the following worked for me.

Visual Studio

After you have create a new Project using File > New Project > ASP.NET Web Application


Change the build to use x64 and not ANY CPU


Now Right click on the project and choose publish. We will use File System publishing to push the output to a folder location and then get IIS to load it


Publish target is inside default IIS web root folder. This might be different for your setup.


Use 64 bit release in settings

Finally publish it


So with this step done your web application is now published to c:\inetpub\wwwroot\HomeServer


Now launch the IIS Manager by hitting Win key and searching for IIS Manager

Right click on default web-site and use Add Application.


Create and point the application to the published app. Note that this is not the top level c:\inetpub\wwwroot\HomeServer, but rather the wwwroot folder inside it. This is required because the web.config is inside that folder. So we use c:\inetpub\wwwroot\HomeServer\wwwroot


Hit, OK to create the web-app and then restart the web-site


Now browse to the web-site, which in my case is http://localhost/HomeServer


Accessing from local network

To access the same website from other devices on the same network you need to enable access through the firewall. Search and select (Win key and type) “Allow an App Through Windows Firewall” then in the Control panel window that opens (Control Panel\System and Security\Windows Firewall\Allowed apps), click the “Change Settings” button and then check “World Wide Web Services”


Find the local servers IP by running the ipconfig command in command shell. Then you can reach this from other devices on the same network.

Screen shot of accessing the web-site from my cell phone connected to the same network over wifi.