報錯信息:
InvalidOperationException: Unable to resolve service for type 'AutoMapper.Mapper'
while attempting to activate 'BLL.Implementation.Report'.
檢查后發現名稱寫錯了
錯誤:
private readonly Mapper _mapper;
正確的是:
private readonly IMapper _mapper;
總結
出現這類錯誤注意檢查接口與實現類名稱
另外一種情況是沒有在startup類的ConfigureServices中注入automapper依賴


