Duplicate informational messages in the Web API console after upgrading to ASP.NET Core 2.0

I upgraded the web API project from ASP.NET Core 1.x to ASP.NET Core 2.0 with minimal code changes.

When starting WebAPI, the command line opens as usual.

However, each informational message is duplicated.

Is this the ASP.NET Core or is it a problem at my end after the upgrade?

UPDATE:

I did the following in Startup.cs Configure:

    loggerFactory.AddConsole(Configuration.GetSection("Logging"));
    loggerFactory.AddDebug();

When I delete it, there are no duplicates. Is it no longer needed?

+4
source share
1 answer

WebHost.CreateDefaultBuilder sets up a lot of ordinary things for you to keep the same code that should be generated for each individual ASP.NET Core 2 project (as it was in ASP.NET Core 1.x).

WebHost.CreateDefaultBuilder . , , :

logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
logging.AddConsole();
logging.AddDebug();

. ( ), , .

, Andrew Lock , . , .. , ASP.NET Core 2 1, , , .

+5

Source: https://habr.com/ru/post/1687379/


All Articles