I want to use Kestrel HTTP Server to do HTTP things unrelated to the ASP.NET abstraction. I don't want to install any of the ASP.NET packages just Kestrel and use Request/Response model to write a fast/performant HTTP application.
In the old days this was done with HttpListener
, but since everything now runs on Linux I can't use HTTP.sys.
Every Kestrel example shows how to use it with ASP.NET Core using the WebHost
thingy.
I just want to run a console application that opens a port and gives me HTTP requests.
I'm almost 100% sure that this is possible. How I'm I supposed to do it?
Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is the web server that's included by default in ASP.NET Core project templates. Kestrel is supported on all platforms and versions that .NET Core supports.
Now, even if you are not working cross-platform, you can run ASP.NET on a web server straight from the command line. Since Kestrel is not a fully-featured web server, you should run it behind IIS or NGINX. It was designed to make ASP.NET as fast as possible but is limited in its ability to manage security and serve static files.
In the case of the Kestrel web server, the process name that is used to host and run the ASP.NET Core application is the project name. As of now, we are using visual studio to run the ASP.NET Core application.
Benefits of Kestrel. Kestrel has support on all platforms and versions supported by .NET Core. Furthermore, it is included by default in ASP.NET Core new project templates and can provide better request processing performance. When you create a new project in Visual Studio, your project is automatically configured to run in Kestrel.
Kestrel has many dependencies to Asp.Net packages in both Transport and Http layer. even if you want to use just Kestrel.Transport
and implement your own HttpServer, you need the packages like Microsoft.AspNetCore.Hosting
in Kestrel.Transport.Abstraction
and Kestrel.Transport.Socket
libraries. So if you want to remove these dependencies, you need a full customize on all Kestrel class libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With