I’ve recently been through the process of deploying an ASP.NET Core site to IIS. While there is documentation for this process, I found that it still wasn’t as straightforward to follow as what I would have liked. This step by step guide with screenshots is the simplest method I’ve found to get it working on my local Windows 8.1 development machine.
The official guide from Microsoft was the most useful reference I found in getting this set up.
Setting up the Dependencies
Visual Studio Tooling
There are a bunch of dependencies that we need to before we can get started. Let’s install these first.
Firstly, make sure that you have the latest version of the Microsoft ASP.NET and Web Tools installed. Mine was out of date initially, so I actually had to update this in order to get the project to compile.
ASP.NET 5 uses a different handler which is not installed by default. ASP.NET5 RC1 (the latest version at the time of writing) requires version 1.2 or higher.
This can be downloaded at the following locations:
Ensure that you’ve got the latest version of the run-time available using the following command:
dnvm upgrade <
Publishing the Project
After you've created the new project in Visual Studio 2015 or your text editor of choice, open the command prompt and move into the project directory. You'll then run the publish command from the directory one level above wwwroot.
dnu publish . --out "C:publish" --configuration Release --runtime dnx-clr-win-x188.8.131.52-rc1-update1
This should generate the following directory structure under C:publish:
Copy the contents of this directory to the IIS directory:
cd C: xcopy C:publish C:inetpubwwwrootwebapplication7 /s /e
Create a new website in IIS:
Modify the app pool so that it runs with No Managed Code set as the .NET CLR Version
Navigate to the website. If everything has worked correctly you should see the website. In our case we published a Web API endpoint so we see the following default values returned: