Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run ASP.NET 5 site directly on Kestrel in Azure WebApps?

I have checked that in the web response the server is IIS when I deploy ASP.NET5 to azure web app, so I guess the IIS platform handler is used to redirect it to Kestrel. So I am wondering if it is possible to run directly on Kestrel, and what benefits/drawbacks will that have (probably regardless if it's in Azure or not). I suppose it will be a bit faster since IIS will be excluded from the pipline, but it should not be too much overhead I suppose...

like image 561
Ilya Chernomordik Avatar asked Dec 16 '15 12:12

Ilya Chernomordik


People also ask

How do I use Kestrel instead of IIS?

The main difference between IIS and Kestrel is that Kestrel is a cross-platform server. It runs on Linux, Windows, and Mac, whereas IIS is Windows-specific. Another essential difference between the two is that Kestrel is fully open-source, whereas IIS is closed-source and developed and maintained only by Microsoft.

Can we run an ASP.NET Core application without using the built in Kestrel web server?

YES. When we use the InProcess Hosting model, then the application is hosted inside the IIS worker process i.e. w3wp.exe in the case of IIS and iisexpress.exe in the case of IIS Express. That means the Kestrel Web Server is not used with the InProcess hosting model.

Does ASP.NET Core use Kestrel by default?

Kestrel is the web server that's included and enabled by default in ASP.NET Core project templates.


1 Answers

On Azure Web App, you cannot bypass IIS.

But in the general case, you can definitely run Kestrel directly. It is after all just dnx web and it's exactly what the XPlat version (Linux, OSX) will end-up using (almost).

What you lose from not using IIS

  • Security (newer component compared to IIS)
  • Easy setup of SSL
  • Kernel module that handle file/cache and other things (kernel = faster)
  • Application monitoring/Keep-Alive (what happens if Kestrel crash)
  • Multiple hostnames single-port (80) reuse
  • etc.

What you gain from not using IIS

  • Complete control over your process
  • Higher overall performance
  • Simpler installation/execution

What you should do if you choose not to use IIS

If you are OK with the "lose" points, I would still go and host your Kestrel behind a reverse proxy or an NGINX server. Kestrel was made to be "production ready" but it's not NGINX or IIS.

It will not keep itself alive as far as I know.

If I missed anything, please let me know.

like image 196
Maxime Rouiller Avatar answered Sep 21 '22 14:09

Maxime Rouiller