错误:
System.AggregateException:“Some services are not able to be constructed (Error while validating the service descriptor ‘ServiceType: Microsoft.Extensions.Hosting.IHostedService Lifetime: Singleton ImplementationType: WebApplication9.Models.BgServerTest‘: Cannot consume scoped service ‘WebApplication9.Models.Imywork‘ from singleton ‘Microsoft.Extensions.Hosting.IHostedService‘.)”
InvalidOperationException: Cannot consume scoped service ‘WebApplication9.Models.Imywork‘ from singleton ‘Microsoft.Extensions.Hosting.IHostedService‘.
解决办法 :
依赖注入时出错:Cannot consume scoped service 'xxx' from singleton 'yyy'