简体   繁体   English

HTTP.sys 与 Kestrel:为什么选择其中之一? 优点缺点?

[英]HTTP.sys vs Kestrel: Why choose one over the other? Pros Cons?

What is the reason for two separate but similar servers?两个独立但相似的服务器的原因是什么? What are the differences?有什么区别? Can I run both in docker?我可以在 docker 中同时运行吗? Do both support same things, like all authentication types?是否都支持相同的东西,比如所有的身份验证类型?

Kestrel vs HTTP.sys - I've highlighted the fundamental differences below. Kestrel 与 HTTP.sys - 我在下面强调了基本差异。

(The words are Microsoft's and I've only edited it for brevity and clarity. See the sources linked at the bottom). (这些词是微软的,我只是为了简洁和清晰起见对其进行了编辑。请参阅底部链接的来源)。


Update:更新:

Kestrel previously always required the use of a reverse proxy with edge deployments (exposed to traffic from the Internet) for security reasons.出于安全原因,Kestrel 以前总是需要在边缘部署(暴露于来自 Internet 的流量)中使用反向代理。 With Kestrel in ASP.Net Core 2.x this is no longer the case.使用 ASP.Net Core 2.x 中的 Kestrel,情况不再如此。 Take a look at the documentation for more information.查看文档以获取更多信息。 Kestrel Web Server Documentation Kestrel Web 服务器文档

红隼 1.x 与 2.x

Weblistener was renamed HTTP.sys in ASP.NET Core 2.0 Weblistener 在 ASP.NET Core 2.0 中更名为 HTTP.sys

Sources:资料来源:

  1. Docs.Microsoft.com Web server implementations in ASP.NET Core ASP.NET Core 中的Docs.Microsoft.com Web 服务器实现
  2. Docs.Microsoft.com HTTP.sys web server implementation in ASP.NET Core Docs.Microsoft.com HTTP.sys Web 服务器在 ASP.NET Core 中的实现

HTTP.sys is windows-only HTTP / Web Server for ASP.NET Core that allows you to expose the server directly to the Internet without needing to use IIS. HTTP.sys是用于 ASP.NET Core的仅限 Windows 的HTTP/Web 服务器,它允许您将服务器直接公开到 Internet,而无需使用 IIS。 HTTP.sys is built on top of Http.Sys ( the same mature technology that also powers IIS' HTTP Listener) as is as such very feature rich and provides protection against various attacks . HTTP.sys 建立在 Http.Sys(同样成熟的技术,也支持 IIS 的 HTTP 侦听器)之上,因此功能非常丰富,提供对各种攻击的保护

Kestrel on the other hand, is a cross-platform web server for ASP.NET Core that is designed to be run behind a proxy (for example IIS or Nginx) and should not be deployed directly facing the Internet .另一方面, Kestrel是 ASP.NET Core 的跨平台Web 服务器,旨在在代理(例如 IIS 或 Nginx)之后运行,不应直接面向 Internet 部署 Kestrel is relatively new and does not have a full complement of defenses against attacks . Kestrel 相对较新,没有完整的攻击防御措施 It's also not as feature rich as HTTP.sys and comes with timeout limits, size limits and concurrent user limits.它也没有HTTP.sys那样丰富的功能,并带有超时限制、大小限制和并发用户限制。


In essence, the choice comes down to your web application's Deployment scenario.本质上,选择归结为您的 Web 应用程序的部署方案。

HTTP.sys Use Cases : HTTP.sys 用例:

在此处输入图片说明

Kestrel Use Cases :红隼用例:

在此处输入图片说明

Following comparison will help you to choose which one is better以下比较将帮助您选择哪个更好

在此处输入图片说明

The ASP.NET 5 documentation ( created by Microsoft on August 25, 2015 ) found here lists the chart found in the other answer (see page 107 of the bottom right book pages, but page 111 of the PDF): https://media.readthedocs.org/pdf/aspnet/theming/aspnet.pdf此处找到的 ASP.NET 5 文档(由 Microsoft 于 2015 年 8 月 25 日创建)列出了在另一个答案中找到的图表(参见右下书页的第 107 页,但 PDF 的第 111 页): https://media .readthedocs.org/pdf/aspnet/theming/aspnet.pdf

Kestrel in general has better performance, if you used for one of the following below:如果您用于以下其中一项, Kestrel通常具有更好的性能:

  • Great option if used in conjunction with a reverse proxy for apps exposed to Internet如果与暴露于 Internet 的应用程序的反向代理结合使用,则是不错的选择
  • Internal apps connecting with other internal apps on a private virtual network (not exposed to Internet)内部应用程序与私有虚拟网络上的其他内部应用程序连接(不暴露于 Internet)

WebListener is more secure, slower, and has more features. WebListener更安全、更慢,并且具有更多功能。 It is used in these cases:它用于以下情况:

  • Expose app to the Internet but can't use IIS Require higher security and exposing server directly to Internet.将应用程序暴露给 Internet 但不能使用 IIS 需要更高的安全性并将服务器直接暴露给 Internet。
  • Additional features: List item, Windows Authentication, Port sharing, HTTPS with SNI, HTTP/2 over TLS (Windows 10), Direct file transmission, Response caching附加功能:列表项、Windows 身份验证、端口共享、HTTPS with SNI、HTTP/2 over TLS (Windows 10)、直接文件传输、响应缓存

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM