Кто -нибудь еще сталкивается с этим раньше, и есть идеи, как начать его отладки?
< P> Очевидно, что Stacktrace очень шумная: < /p>
Код: Выделить всё
Unhandled exception. System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: MediatR.IRequestHandler`2[Webapp.Core.Commands.AddPublicHolidayCountryCommand,Webapp.Core.Commands.Behaviors.LoggableCommandResult] Lifetime: Transient ImplementationType: Webapp.Core.Commands.AddPublicHolidayCountryCommandHandler': Unable to resolve service for type 'Webapp.Core.Locking.ILockManager' while attempting to activate 'Webapp.Core.Commands.AddPublicHolidayCountryCommandHandler'.)
< /code>
👆 Есть много из этого - почти как будто он вообще не зарегистрировался, но мы явно называем настройку для настройки Webjob, используя стандартную ServiceCollection.AddTransient В веб -приложении мы раскручиваем DI, используя привязку на основе конвенции:
Код: Выделить всё
services.Scan(scan => scan
.FromAssemblyOf()
.AddClasses(classes => classes
.InNamespaces("Webapp.Core.Repositories", "Webapp.Core.Services",
"Webapp.Core.Services.Slack")
.Where(t => t != typeof(TeamsMessagingService)))
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
.AsMatchingInterface()
.WithScopedLifetime()
Подробнее здесь: https://stackoverflow.com/questions/794 ... e-in-net-8