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.