0
웹 API를 호스팅하는 콘솔 응용 프로그램이 있습니다. 이제 이미 구성한 IServiceCollection
과 ILoggerFactory
을 내 Startup
에 전달하려고합니다..NET Core 2에서 기존 IServiceCollection 및 ILoggerFactory를 시작으로 전환
var serviceCollection = new ServiceCollection();
// Do some registrations here...
var loggerFactory = new LoggerFactory(); // Actually not created this way. Just an example.
loggerFactory.AddSomeStuff();
var host = WebHost.CreateDefaultBuilder()
.UseKestrel()
.ConfigureServices(collection =>
{
// I want to use my already configured serviceCollection.
// I do not want to configure it here...
})
.ConfigureLogging((hostingContext, logging) =>
{
// I want to use my already configured ILoggerFactory.
// I do not want to configure it here...
})
.UseStartup<Startup>()
.Build();
은 기본적으로 내 시작 사용하려는 내 이미 loggerFactory
및 serviceCollection
를 만들었습니다. 그게 가능하니? 그렇다면 어떻게해야합니까?