简体   繁体   English

ASP.NET Core、Kestrel和IIS之间有什么关系?

[英]Whats the relationship between ASP.NET Core, Kestrel and IIS?

When I create a new project in Visual Studio using the "ASP Net Core Web Application" template, and press F5 (or click the "IIS Express" debug button), what exactly is happening in the background in terms of web servers?当我使用“ASP Net Core Web 应用程序”模板在 Visual Studio 中创建一个新项目并按 F5(或单击“IIS Express”调试按钮)时,web 服务器的后台到底发生了什么?

  1. Does it start an IIS webserver as reverse proxy with a kestrel application server which serves my app (I guess so)?它是否启动 IIS 网络服务器作为反向代理,并带有为我的应用程序提供服务的 kestrel 应用程序服务器(我猜是这样)?
  2. Can I / How can I run the app without IIS (only using Kestrel)?我可以/如何在没有 IIS 的情况下运行应用程序(仅使用 Kestrel)?
  3. Why can't I access my data when I use localhost:5000 (default Kestrel port) instead of localhost:63152 (IIS port)?为什么我使用 localhost:5000(默认 Kestrel 端口)而不是 localhost:63152(IIS 端口)时无法访问我的数据? Shouldn't I be able to access Kestrel directly, even if IIS serves as a proxy?即使 IIS 充当代理,我不应该能够直接访问 Kestrel 吗?
  4. When I dockerize the app with the default container mcr.microsoft.com/dotnet/core/sdk:3.1 and run it, does this also start an IIS + Kestrel inside the container?当我使用默认容器mcr.microsoft.com/dotnet/core/sdk:3.1并运行它时,这是否还会在容器内启动 IIS + Kestrel?
  1. The IIS express will run like you say as a proxy in front of the kestrel process. IIS express 将像您所说的那样作为 kestrel 进程前面的代理运行。 In earlier versions of.Net IIS would also run the application but now that is handled by kestrel.在早期版本的 .Net IIS 中也会运行该应用程序,但现在由 kestrel 处理。

  2. In your project you will have (else you can create it) a folder called Properties with a file called launchSettings.json where you can specify profiles for how you want to run your project.在您的项目中,您将拥有(否则您可以创建它)一个名为 Properties 的文件夹,其中包含一个名为 launchSettings.json 的文件,您可以在其中指定如何运行项目的配置文件。 In most cases this will be created when you create a new project in VS.在大多数情况下,这将在您在 VS 中创建新项目时创建。 Here you can add or modify profiles.您可以在此处添加或修改配置文件。

To run your project without IIS express your profile should have "commandName": "Project" .要在没有 IIS 的情况下运行您的项目,您的配置文件应该有"commandName": "Project" You can then choose what profile to run using the interface of VS.然后,您可以使用 VS 的界面选择要运行的配置文件。

  1. Im not entirely sure why you cant access this.我不完全确定你为什么不能访问它。

  2. That depends on your docker file but if you use the standard file it will not use IIS.这取决于您的 docker 文件,但如果您使用标准文件,它将不会使用 IIS。

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

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