NET Centric Computing - Old Questions

5. How do you host and deploy the ASP.NET core application.

5 marks | Asked in Model Question

There are 2 types of hosting models in ASP.NET Core:

1. Out-of-process Hosting Model: In Out-of-process hosting models, we can either use the Kestrel server directly as a user request facing server or we can deploy the app into IIS which will act as a proxy server and sends requests to the internal Kestrel server. In this type of hosting model, we have two options:

  • Using Kestrel: Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is the webserver that's included by default in ASP.NET Core project templates. Kestrel itself acts as edge server which directly server user requests. It means that we can only use the Kestrel server for our application.
  • Using a Proxy Server: Due to limitations of the Kestrel server, we cannot use this in all the apps. In such cases, we have to use powerful servers like IIS, NGINX or Apache. So, in that case, this server acts as a reserve proxy server which redirects every request to the internal Kestrel sever where our app is running. Here, two servers are running. One is IIS and another is Kestrel.

2. In-process Hosting Model:  In this type, only one server is used for hosting like IIS, Nginx or Linux. It means that the App is directly hosted inside of IIS. No Kestrel server is being used. IIS HTTP Server (IISHttpServer) is used instead of the Kestrel server to host apps in IIS directly.


Steps to Deploy ASP.NET Core to IIS:

Step 1: Publish to a File Folder. Publish to Folder With Visual Studio.

Step 2: Copy Files to Preferred IIS Location. 

Step 3: Create Application in IIS.

Step 4: Load Your App!