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 HttpRuntime of 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 run command to fire up the application the first time it is requested.
This module is configured via the web.config file in the root of the application.
<?xml version="1.0" encoding="utf-8"?>
<system.webServer>
</system.webServer>But you don't have to worry too much about this web.config since it's automatically generated, together with the compiled DLLs and other configuration files, when you run the dotnet publish command.
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.
To know more about what I'm publishing, don't forget to check my blog again, subscribe to my RSS feed, follow me on twitter or like the Facebook page of my book.