shahedc/WorkerServiceSample

ConfigureHostDefaults

Closed this issue · 0 comments

Hello,

I am wondering if you have ConfigureHostDefaults for a Worker Service like you have ConfigureWebHostDefaults for a ASP.Net Core Web Application?

You can use ConifugreWebHostDefaults together with UseStartup in a WorkerService but then your service starts to listen at the default ports...

public static void Run(string[] args)
{
    using (IHost host = Host.CreateDefaultBuilder(args)
            .UseContentRoot(Directory.GetCurrentDirectory())
            .ConfigureWebHostDefaults(webBuilder => webBuilder
            .UseStartup<TStartup>())
            .Build())
    {
        host.Run();
    }
}