3
votes

I have created a sample ASP.NET Core app with the name EmployeeManagement. The app is configured explicitly for out-of-process hosting as below,

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>

The primary goal of this application is to display current running process name.

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
  ...

  app.UseEndpoints(endpoints =>
  {
   endpoints.MapGet("/", async context =>
   {
      await context.Response.WriteAsync(System.Diagnostics.Process.GetCurrentProcess().ProcessName);
   });
  });
}

And when I run the application using dotnet CLI, it displays

EmployeeManagement

Why it does not display dotnet as process name? As we are running the application using dotnet CLI, application might be hosted and running in Kestrel server. So, I assume dotnet.exe should be the hosting process.

If the application is configured for InProcess hosting model. it displays

iisexpress

as process name. The target framework is .NET Core 3.1 version.

1

1 Answers

2
votes

Starting with ASP.NET Core 3.0 a host exe ("apphost") is generated automatically for the platform you're currently building on (except for macOS due to its signing/notarization requirements), so the EmployeeManagement.exe in your bin folder will be used to run the .NET Core Runtime.

You should see a difference if you directly use dotnet bin\netcoreapp3.1\EmployeeManagement.dll or set the following in the csproj:

<PropertyGroup>
  <UseAppHost>False</UseAppHost>
</PropertyGroup>