Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while attempting to activate 'xxxx'.

Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while attempting to activate 'xxxx'.

构造注入时需要加入类名

    public class DeviceStateCommand : IAsyncCommand<DeviceCommunicationPackageInfo>
    {
        private readonly ILogger _logger;

        public DeviceStateCommand(ILogger<DeviceStateCommand> logger)
        {
            _logger = logger;
        }
    }
posted @ 2020-12-23 17:03  NiKaFace  阅读(749)  评论(0编辑  收藏  举报