Click here to Skip to main content
13,803,326 members
Click here to Skip to main content
Add your own
alternative version


7 bookmarked
Posted 1 Nov 2016
Licenced CPOL

How to Publish ASP.NETCore MVC Web Application to IIS in Less Than 5 Minutes

, 1 Nov 2016
Rate this:
Please Sign up or sign in to vote.
A good tutorial in how you can publish your ASP.NETCore MVC web application to IIS.


This tip will give you an easy way to publish your ASP.NETCORE web application to IIS.

Using the Code

In this tip, I will try to publish my last demo (CRUD-in-ASP-NETCore-MVC-with-Angular-and-Web-Api) to IIS. To understand this tutorial well, I recommend you download the project.

A) Setup IIS

I recommend you follow steps from this link: how-to-install-iis-on-windows.

B) Second: Export your ASP.NETCORE Project

Open your cmd command-line, navigate to the project root folder and write the below command-line:

dotnet publish --framework netcoreapp1.0 --output [destination folder] --configuration Realease

[destination folder ]: the directory name that will contain the publish result. For example : "E:\website\dotnetcoreapp".

C) Create a New Website from Your IIS Manager

Open the IIS manager and add a new web site: for example, dotnetcoreapp that has 'E:\website\dotnetcoreapp' as a physical path.

D) Set the .NET CLR Version

In IIS MANAGER, find the Application Pool related to your website, and change the .NET CLR version to 'No Managed Code'.

E) Grant Permissions to Your IIS App Pool

This step is very important, if you want to avoid exceptions related to the database connection failure.

Open your SGBD (in this example, I will show you TSQL instructions for SQL SERVER), write the following commands, to create a new account in SQL Server for your IIS Application Pool and grant Read and Write permissions to your specific database.

use DataBaseDotnetCore
EXEC sp_addrolemember N'db_datareader' ,N'IIS APPPOOL\dotnetcoreapp'
EXEC sp_addrolemember N'db_datawriter' ,N'IIS APPPOOL\dotnetcoreapp

Check these permissions from your SGBD:

F) Open the Web Site

Finally, open the given url (http://localhost:8082/), you should be able to display the default page (index.html) and to retrieve data from your database.

Points of Interest

Thank you for reading this post. I hope that you appreciated it, and I'm waiting for your feedback .


  • Initial version: 01/11/2016


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

France France
Microsoft certified professional in C# ,HTML 5 & CSS3 and JavaScript,, and Microsoft Azure.

You may also be interested in...


Comments and Discussions

QuestionWill this work with older IIS version such as version 7.x windows 2008 server r2? Pin
Member 127940773-Nov-16 2:43
memberMember 127940773-Nov-16 2:43 
AnswerRe: Will this work with older IIS version such as version 7.x windows 2008 server r2? Pin
O.Nasri3-Nov-16 5:48
professionalO.Nasri3-Nov-16 5:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.181215.1 | Last Updated 1 Nov 2016
Article Copyright 2016 by O.Nasri
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid