Unable to resolve service for type的问题

今天写了一个方法和接口,需要将接口通过依赖注入的方式注入到Controller里面,但是却出现了InvalidOperationException: Unable to resolve service for type 'WebAPI.Services.IPropertyCheckerService' while attempting to activate 'WebAPI.Controllers.CompaniesController'.在网上搜了之后才发现,需要在StartUp的Service里面注册一下。

 

posted @ 2020-04-28 23:15  游园惊梦、  阅读(13124)  评论(2编辑  收藏  举报