Introduction
ASP.NET Core is able to run as a standalone Application (out of process Console Application). It does not host inside IIS, which does not require IIS to run an application. ASP.NET Core app has its own self-hosted Web Server and processes the requests, which internally use the self-hosted Server instance. ASP.NET Core uses Kestrel Server to host the core Application but it does not support all the features of the Server such as IIS.
In older ASP.NET Web applications, everything is hosted inside IIS Worker process, which can also refer to an Application pool. The Application Pool hosts our Web Application and our Web Application is instantiated by the built-in ASP.NET hosting features in IIS. The ASP.NET Core Application does not run in the IIS worker process but runs as a separate out of process Console Application, which runs its own Web Server, using Kestrel Web Server. If we run on Windows, we may want to run Kestrel behind IIS to gain infrastructure features such as port forwarding via host headers, life cycle and certificate management.
ASP.NET Core Application is a standalone console Application that is invoked through the "dotnet" runtime command. It does not load into the IIS worker process but loads in the native IIS module called "AspNetCoreModule" which runs the console application. We need to install the AspNetCoreModule on the Server and it is part of ASP.NET Core Server Hosting Bundle.
ASP.NET Core Application is a standalone console Application that is invoked through the "dotnet" runtime command. It does not load into the IIS worker process but loads in the native IIS module called "AspNetCoreModule" which runs the console application. We need to install the AspNetCoreModule on the Server and it is part of ASP.NET Core Server Hosting Bundle.
All IIS applications are run on application pool. For ASP.net core, application pool must set to use No Managed Code. The Application pool acts only as a proxy to forward the requests. There is no need to instantiate a .NET runtime.
The primary job of AspNetCoreModule is to ensure that our Application gets loaded when the first request comes. All incoming Http request are handled by AspNetCoreModule and then it is routed to ASP.NET Core Application. Kestrel picks up the incoming request and passes into ASP.NET Core middleware pipeline that subsequently handles the request and passes to the Application logic, which is the same as the response of the Application which is pushback to the IIS and then Http client.
AspNetCoreModule is configured via the web.config file, which is stored in an Application root folder, which contains the startup command and argument. The dotnet is a startup command and our Application main DLL, which is used to launch application as aargument.
The Web.config file looks, as shown below.
- <?xml version="1.0" encoding="utf-8"?>
- <configuration>
- <system.webServer>
- <handlers>
- <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
- </handlers>
- <aspNetCore processPath="dotnet" arguments=".\FirstCoreApplication.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
- </system.webServer>
- </configuration>
Publishing ASP.NET Core Application
To host our Application on IIS, we first need to publish it. There are two ways to publish .NET Core Application
- Using CLI command dotnet publish.
- Using Visual Studio Publishing feature.
Before publishing ASP.NET Core Application, we make sure that we are including all the required folders in PublishOptions node of project.json file. This node looks, as shown below.
- "publishOptions": {
- "include": [
- "Views",
- "web.config"
- ]
- }
Using CLI command “dotnet publish”
.NET Core Application also supports CLI. Using CLI tool, we can create, build and publish the .NET Core Application. The "dotnet publish" command compiles the Application and publishes the Application with the project dependencies (specified in project.json file) and puts it into a specified folder.
.NET Core Application also supports CLI. Using CLI tool, we can create, build and publish the .NET Core Application. The "dotnet publish" command compiles the Application and publishes the Application with the project dependencies (specified in project.json file) and puts it into a specified folder.
- >dotnet publish

Sandip PatilPosted Oct 12, 2018, 4:19 AM
I am using same functionality. and its running on the server, but some .css files are not able to call, like bootstrap.css, by default it will be calling from ajax cdn, how to resolved this issue?
Vladimir VingPosted Oct 8, 2017, 3:43 AM
I use Asp.net Core 2 and after publish VIEWS folder is no. I written publishOption in project.json and appsettings.json but it not help. I tested the Asp.net Core 1.1 project and after publish the VIEWS folder is always. (by Default)
malathi puttaiahPosted Jul 26, 2017, 7:30 AM
Want to launch .net core app to third party server somee.com , getting HTTP Error 500.19 - Internal Server Error. Can i get help urgently.
John RadleyPosted Mar 27, 2017, 11:25 AM
Thanks for your article. Although my specific interest is ASP.NET Core on Linux with Nginx. your article is very helpful in understanding the new ASP.NET Core technology.Thx again John
Manav PandyaPosted Mar 27, 2017, 12:15 AM
Thanks for sharing this sir Jignesh Trivedi