首页 > 其他 > 详细

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

时间:2021-08-06 23:51:21      阅读:88      评论:0      收藏:0      [点我收藏+]

错误:

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'

原文:https://www.cnblogs.com/lunawzh/p/15110389.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!