Asp.net-Core-Mvc

MVC Core - UseIIS 和 UseIISIntegration 有什麼區別

  • April 14, 2019

查看程式碼,他們有相同的註釋,表明他們做同樣的事情:

/// <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>

UseIISMicrosoft.AspNetCore.Server.IIS包裝中,而UseIISIntegrationMicrosoft.AspNetCore.Server.IISIntegration.

兩者有什麼區別?什麼時候需要使用其中一種?(或者兩者兼而有之?)

更新: github上有一個類似的問題,但那裡沒有有用的答案:https ://github.com/aspnet/AspNetCore/issues/6197

在 ASP.NET Core 2.2 之前,ASP.NET Core 託管在 IIS 中的程序外,這意味著我們有兩個應用程序程序:

  1. w3wp.exe,IIS程序;和
  2. dotnet.exe,ASP.NET Core 程序,Kestrel Web 伺服器在此啟動。

這意味著 IIS 和 Kestrel 在這兩個程序之間進行通信。

對於這種情況,您將使用UseIISIntegration.


ASP.NET Core 2.2 引入了程序內託管,您的 ASP.NET Core 應用程序在 IISw3wp.exe程序內執行,無需 Kestrel Web 伺服器,在這種情況下,您希望使用UseIIS.

筆記:

引用自:https://stackoverflow.com/questions/55673395