[英]Reverse proxy and in-process HTTP server in Asp.Net Core
I was reading about Kestrel
web server in asp.net core app
specifically the in-process http server
and reverse proxy
. 我正在阅读asp.net core app
Kestrel
web服务器,特别是in-process http server
和reverse proxy
。
Being a seasonal web developer, I have trouble in understanding the idea behind: 作为季节性的Web开发人员,我无法理解背后的想法:
in-process http server
implementation in core application ? in-process http server
实现在核心应用程序中的相关性? web server
? 反向代理方法对任何典型web server
的重要性? http request
? 除了转发http request
之外,问题的类型是否在asp.net核心世界中解决了反向代理问题? reverse proxy
and Kestrel
correlate / communicate ( 1:n
or 1:1
) if the asp.net core app is meant to be deployed in a container? 如果asp.net核心应用程序要部署在容器中, reverse proxy
和Kestrel
如何关联/通信( 1:n
或1:1
)? According to official documentation : 根据官方文件 :
ASP.NET Core was designed to run in its own process so that it can behave consistently across platforms. ASP.NET Core旨在在其自己的进程中运行,以便它可以跨平台一致地运行。 IIS, Nginx, and Apache dictate their own startup process and environment; IIS,Nginx和Apache决定了他们自己的启动过程和环境; to use them directly, ASP.NET Core would have to adapt to the needs of each one. 要直接使用它们,ASP.NET Core必须适应每个人的需求。 Using a web server implementation such as Kestrel gives ASP.NET Core control over the startup process and environment. 使用诸如Kestrel之类的Web服务器实现为ASP.NET Core提供了对启动过程和环境的控制。 So rather than trying to adapt ASP.NET Core to IIS, Nginx, or Apache, you just set up those web servers to proxy requests to Kestrel. 因此,您只需将这些Web服务器设置为代理对Kestrel的请求,而不是尝试将ASP.NET Core调整为IIS,Nginx或Apache。 This arrangement allows your Program.Main and Startup classes to be essentially the same no matter where you deploy. 无论您在何处部署,这种安排都允许您的Program.Main和Startup类基本相同。
Besides that having the in-process http server makes stuff really easier for developers. 除了具有进程内http服务器使开发人员更容易使用的东西。 They just download the framework, install it and it works out of the box no matter what OS they are using (Windows, Linux or MacOS) or what web server they want to use later. 他们只是下载框架,安装它,无论他们使用什么操作系统(Windows,Linux或MacOS)或他们想要在以后使用什么Web服务器,它都可以开箱即用。 They just fire dotnet run
command which starts the http server with a web app hosting on it. 他们只是启动了dotnet run
命令,启动了http服务器并在其上托管了一个Web应用程序。
While it's OK to run it in a development environment when an app is ready for production developers should remember about security. 虽然在应用程序准备好生产时在开发环境中运行它是可以的,但开发人员应该记住安全性。 The Kestrel web server is very new web server so it doesn't have all that security and other useful features as IIS, Apache or Nginx obtained during their long lives. Kestrel Web服务器是一个非常新的Web服务器,因此它不具备IIS,Apache或Nginx在其长寿期间获得的所有安全性和其他有用功能。 This is the only reason why MS recommends to use reverse-proxy in production environment. 这是MS建议在生产环境中使用反向代理的唯一原因。 The goal of reverse proxy is not only forward requests to in-process http server, but also be responsible for security, compression and other features a good web server may provide. 反向代理的目标不仅是对进程内http服务器的转发请求,而且还负责安全性,压缩和良好的Web服务器可能提供的其他功能。
As for container deployments it really depends on what you want to achieve. 至于容器部署,它实际上取决于您想要实现的目标。 There are different scenarios: 有不同的场景:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.