Header add

In this article we will discuss what is Kestrel Web Server in ASP.NET Core. If you miss our previous article then please follow the link ASP.Net Core Hosting model. In ASP .NET Core there are 2 web servers i.e. one internal web server and one external web server. The internal web server is called as Kestrel and the external web server can be IIS, Apache or Nginx. In this article we will cover,
  • What is a Kestrel Web Server ?
  • How to run a .NET Core application using .NET Core CLI ?
What is a Kestrel Web Server ?

Kestrel is a cross-platform web server for ASP.NET Core that means it supports developed and run applications on different types of operating systems such as Windows, Linux, or Mac. It is supported on all platforms and versions that .NET Core supports. It is included by default as internal server in ASP.NET Core. Kestrel can be used, by itself as an edge server i.e Internet-facing web server that can directly process the incoming HTTP requests from the client. In Kestrel, the process used to host the app is dotnet.exe.

As of now, we are using visual studio to run the ASP.NET Core application. By default, the visual studio uses IIS Express to host and run the ASP.NET Core application. So the process name is IIS Express that we already discussed in our previous article. We can also run the ASP.NET Core application from the command line using the .NET Core CLI. The CLI stands for Command Line Interface.

How to run .NET Core application using .NET Core CLI ?

When we run an ASP.NET Core application using the .NET Core CLI, then the .NET Core runtime uses Kestrel as the webserver. The .NET Core CLI (Command Line Interface) is a cross-platform tool that is used for developing ASP.NET core applications on cross-platform such as windows, mac or Linux.

Open command prompt and type “dotnet --” and press enter as shown below.


After type of "dotnet --" hit the enter button then you found lots of command are found,


Using the CLI (above commands)

dotnet new myCoreDemo
  • You can create a new project using the new command, you can also build the project using the build command, or you can publish the project using the publish command.
  • It is possible to restore the dependencies and tools which are required for a .net core project using the CLI
Running .NET Core application using .NET Core CLI

Open the Command Prompt and move the directory where the application is present.


After move the application directory then execute "dotnet run" command as shown below; the kestrel server line is now listening to the specified port, copy that and run in browser then you can check the output as expected. 









 Summary
 In this tutorial we discussed Kestrel Web Server in ASP.NET Core. If have any question related to this topic then give your feedback.


You May Also Like...

Post a Comment

Previous Post Next Post