After developing the ASP.NET Core application, adding client-side interactivity with Angular and styling with Bootstrap, all automated using webpack and with dependencies managed with Nuget, the time has come to deploy the application.
My upcoming "Front-end Development with ASP.NET Core, Angular, and Bootstrap" book explains how to deploy ASP.NET Core applications with three different methods:
- On-Prem on IIS
- On Azure App Services
- To Docker containers
On day 15 of my advent calendar I'm showing how to publish to a local IIS.
In "classic" ASP.NET, applications are DLLs that are hosted inside the IIS Application Pool (also known as Worker Process,
w3wp.exe). They are instantiated from IIS's runtime manager. When requests come in, they are sent to the
HttpRuntimeof the right site, which lives inside an AppPool. In short, they are basically modules controlled by IIS itself.
In ASP.NET Core, it is totally different. ASP.NET Core applications (remember, they are all console applications) run their own web server using Kestrel. Each application already hosts itself and can directly respond to requests over HTTP, so you might be wondering why you need IIS in first place.
In this case IIS basically acts as a reverse proxy, receiving the requests and forwarding them to the ASP.NET Core application self-hosted on a Kestrel web server. Then it waits for the execution pipeline to complete its processing and sends back the HTTP output to the originator of the request.
This is accomplished by
AspNetCoreModule, which calls the
dotnet runcommand to fire up the application the first time it is requested.
This module is configured via the
web.configfile in the root of the application.
<?xml version="1.0" encoding="utf-8"?>
But you don't have to worry too much about this
web.configsince it's automatically generated, together with the compiled DLLs and other configuration files, when you run the
Now rarely people still deploy to servers on premise, so tomorrow I'm going to show how deploying to Azure. Come back to my blog to read more, and to read more about deploying applications on IIS and Azure, please consider pre-ordering my book.