Reputation: 816
I use .net core 2.1 and published it to IIS 8.5. I have a hard time to understand the concept OF .NET core hosting.
The program.cs is
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
You see there is no UseKestrel
word, but in the response header, it shows Server is Kestrel.
Also in the project file, there is no <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
. And I don't have the code such as UseIISIntegration
.
Summary of my questions:
Kestrel
?inprocess
or outofprocess
?AspNetCoreModule
, but which file?(w3wp?)Upvotes: 2
Views: 3136
Reputation: 21
If you compare documentation:
v 2.1: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.1
and v 2.2: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.2
you can see at the very beginning the differences between the versions.
In 2.1:
Because ASP.NET Core apps run in a process separate from the IIS worker process, the module also handles process management. The module starts the process for the ASP.NET Core app when the first request arrives and restarts the app if it crashes. This is essentially the same behavior as seen with ASP.NET 4.x apps that run in-process in IIS that are managed by the Windows Process Activation Service (WAS).
And in v 2.2:
The ASP.NET Core Module is a native IIS module that plugs into the IIS pipeline to either: Host an ASP.NET Core app inside of the IIS worker process (w3wp.exe), called the in-process hosting model. Forward web requests to a backend ASP.NET Core app running the Kestrel server, called the out-of-process hosting model.
In-process is default for v 2.2.
I tested my setup on v 3.1, in-process model and it works as you expected. Locally, it returns kestrel, on IIS, it returns IIS server.
All your answers are under those two links.
Upvotes: 2
Reputation: 52636
Your question:
- Why it uses Kestrel?
- Is it inprocess or outofprocess?
- Which file handles this particular case? I assume that it is AspNetCoreModule, but which file?(w3wp?)
Answer:
dotnet run
command for running.w3wp.exe
and dotnet.exe
Image source and reference document: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#out-of-process-hosting-model
Upvotes: 3