报错信息:
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依赖