asp.net-coreasp.net-core-2.2

How to get the process name iisexpress instead of dotnet in asp.net core 2.2


I am learning asp.net core when executing in browser i am getting response header has kestrel instead of iisexpress. I wrote the following code in Startup.cs configure method to get the process name but i'm still getting dotnet i'm not able to get iisexpress.

app.Run(async (context) => {
  await context.Response.WriteAsync("Hello World!\n");
  await context.Response.WriteAsync(System.Diagnostics.Process.GetCurrentProcess().ProcessName);//dotnet             
});

In Program.cs I add .UseIIS()

public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 
  WebHost.CreateDefaultBuilder(args)
    .UseIIS()
    .UseStartup<Startup>();

Following is from .csproj file

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RootNamespace>CookieStore</RootNamespace>
</PropertyGroup>

Kindly help me to run the project both in InProcess and OutOfProcess.


Solution

  • Finally today the issue got resolved, after I updated my Visual Studio 2017. Earlier I used VS2017 15.3 after the update to VS2017 15.9, the issue has been resolved.