今天寫了一個方法和接口,需要將接口通過依賴注入的方式注入到Controller里面,但是卻出現了InvalidOperationException: Unable to resolve service for type 'WebAPI.Services.IPropertyCheckerService' while attempting to activate 'WebAPI.Controllers.CompaniesController'.在網上搜了之后才發現,需要在StartUp的Service里面注冊一下。