MVC Core-UseIIS和UseIISIntegration有什么区别

des*_*ati 9 model-view-controller core asp.net-core-mvc

查看这些代码,它们具有相同的注释,表明它们执行相同的操作:

/// <summary>
/// Configures the port and base path the server should listen on when 
/// running behind AspNetCoreModule. The app will also be configured 
/// to capture startup errors.
/// </summary>
Run Code Online (Sandbox Code Playgroud)

UseIISMicrosoft.AspNetCore.Server.IIS包中,而UseIISIntegration在中Microsoft.AspNetCore.Server.IISIntegration

两者有什么区别?什么时候需要使用一个与另一个?(或两者皆有?)

更新: github上有一个类似的问题,但是那里没有有用的答案:https : //github.com/aspnet/AspNetCore/issues/6197

Mic*_*iey 14

在ASP.NET Core 2.2之前,ASP.NET Core的进程外托管在IIS中,这意味着我们对应用程序有两个进程:

  1. w3wp.exe,IIS进程;和
  2. dotnet.exe,即启动Kestrel Web服务器的ASP.NET Core进程。

这意味着IIS和Kestrel在这两个进程之间进行通信。

对于这种情况,您可以使用UseIISIntegration


ASP.NET Core 2.2引入了进程内托管,您的ASP.NET Core应用程序在IIS w3wp.exe进程内运行,从而无需使用Kestrel Web服务器,在这种情况下,您可以使用UseIIS

笔记: