G
G
Gennady Kruglov2021-08-11 15:54:40
.NET
Gennady Kruglov, 2021-08-11 15:54:40

How to find host created by CreateHostBuilder(args).Build()?

Good afternoon. I study the features of working with .Net Core, in particular with their generic host mechanism (Generic Host).
I got the feeling that I was confused.
Do I understand correctly that if you create and run a host in a console application, like this:

class Program
    {
        static void Main(string[] args)
        {
            using IHost host = CreateHostBuilder(args).Build();

            host.RunAsync();

            Console.ReadLine();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
            .ConfigureHostConfiguration(builder =>
            {          
                //empty
            });
    }


That this host, will be launched in a separate background-process? That is, the console application process is separate, and the host process is separate? If so, how can I find this host process in the task manager? I only see the application process.

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-08-11
@robinzonejob

That this host, will be launched in a separate background-process? That is, the console application process is separate, and the host process is separate?

No. It will be launched in the same process.
PS: don't forget to write await near calls to asynchronous methods

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question