依赖注入时出错:Cannot consume scoped service 'xxx' from singleton 'yyy'

错误:

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'

 

依赖注入时出错:Cannot consume scoped service 'xxx' from singleton 'yyy'

上一篇:k8s pod启动后停止问题解决


下一篇:Axure PR9使用单键快捷键