Search

Tuesday, December 22, 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

image

Change the build to use x64 and not ANY CPU

image

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

image

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

clip_image001

Use 64 bit release in settings
clip_image002

Finally publish it

clip_image003

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

IIS

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

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

clip_image001[7]

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

clip_image002[7]

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

clip_image003[7]

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

clip_image004

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”

image

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.

clip_image006