Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while attempting to activate 'xxxxx.Controllers.xxxxController'.

构造注入时需要加入类名

public class BookSizesController : Controller
{
private readonly ILogger<BookSizesController> _logger; public xxxxController(ILogger<xxxxController> logger)
{
_logger = logger;
}
}

Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while attempting to activate 'xxxxx.Controllers.xxxxController'.的更多相关文章

  1. Unable to resolve service for type 'Microsoft.AspNetCore.ResponseCompression.IResponseCompressionProvider' while attempting to activate 'Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMid

    System.InvalidOperationException HResult=0x80131509 Message=Unable to resolve service for type 'Micr ...

  2. Unable to resolve service for type 'Microsoft.AspNetCore.Http.IHttpContextAccessor'

    An unhandled exception occurred while processing the request. InvalidOperationException: Unable to r ...

  3. InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager`1[Microsoft.AspNetCore.Identity.IdentityUser]'

    在新建asp.net core 应用后, 添加了自定义的ApplicationDbContext 和ApplicationUser ,并添加了Identity认证后, 会出现 InvalidOpera ...

  4. Core 3.1 MVC 抛异常“InvalidOperationException: No service for type 'Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory' has been registered.”

    .NET Core 的版本是 3.1遇到的问题是 Action 中 return View() 的时候报错 An unhandled exception occurred while processi ...

  5. Asp.Net Core 2.0 项目实战(9) 日志记录,基于Nlog或Microsoft.Extensions.Logging的实现及调用实例

    本文目录 1. Net下日志记录 2. NLog的使用     2.1 添加nuget引用NLog.Web.AspNetCore     2.2 配置文件设置     2.3 依赖配置及调用     ...

  6. 微软日志工厂 Microsoft.Extensions.Logging 中增加 log4net 的日志输出

    前提: 需要nuget   Microsoft.Extensions.Logging.Log4Net.AspNetCore   2.2.6: 描述:解决 .net core 微软日志工厂 Micros ...

  7. 将日志(Microsoft.Extensions.Logging)添加到.NET Core控制台应用程序

    在.NET Core项目中,日志记录是通过依赖项注入进行管理的. 尽管这对于ASP.NET项目效果很好,但在启动Startup.cs中的新项目时,所有这些都会自动创建,而在控制台应用程序中则需要一些配 ...

  8. asp.net core 2.0 Microsoft.Extensions.Logging 文本文件日志扩展

    asp.net core微软官方为日志提供了原生支持,有如下实现 Console Debug EventLog AzureAppServices TraceSource EventSource 并且在 ...

  9. microsoft.extensions.logging日志组件拓展(保存文本文件)

    Microsoft.Extensions.Logging 日志组件拓展 文件文本日志 文件文本日志UI插件 自定义介质日志 Microsoft.Extensions.Logging.File文件文本日 ...

随机推荐

  1. svn命令(转)

    参考资料: 1. http://os.51cto.com/art/200908/143157_all.htm2. https://www.jianshu.com/p/d3ebfa27b3ba3. ht ...

  2. 如何查看WinDbg扩展有哪些命令

    如果您想查看任何windbg扩展所支持的命令,可以采用各种方法. 你可以用!<ext_name>.help命令查看该扩展支持的所有命令.用扩展模块名替换<ext_name>.( ...

  3. GitHub 手把手教你如何把本地项目或代码提交到Github托管

    GitHub 手把手教你如何把项目或代码提交到Github托管 启动Git Bash命令行 重点内容 1.首先打开你的github,点击新建项目,点击new repositories ,然后直接给项目 ...

  4. Spring事务经典案例-银行转账

    1.entity实体类 2.dao层 3.dao实现类 4.service层 5.serviceimpl层 6.大配置.xml <?xml version="1.0" enc ...

  5. Nagios HTTP WARNING: HTTP/1.1 403 Forbidden

    当我们第一次搭建好nagios后会有Nagios HTTP WARNING: HTTP/1.1 403 Forbidden告警 要解决这个问题, 可以创建一个html文件,然后重启两个服务,等待几分钟 ...

  6. thrift 是rpc协议

    PC(Remote Procedure Call,远程过程调用)是建立在Socket之上的,出于一种类比的愿望,在一台机器上运行的主程序,可以调用另一台机器上准备好的子程序,就像LPC(本地过程调用) ...

  7. sql查询条件参数为空

    查询某些值为空的数据 select * from usertable where name is null or page is null

  8. TypeScript in 5 minutes

    https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html Let’s get started by build ...

  9. How to Use Convolutional Neural Networks for Time Series Classification

    How to Use Convolutional Neural Networks for Time Series Classification 2019-10-08 12:09:35 This blo ...

  10. 避免git clone和push时每次都需要输入用户名和密码

    有三种方式解决git clone时每次都需要输入用户名和密码, 1. SSH免密方式 使用git bash ssh-keygen或puttygen.exe生成公钥. 2. 配置全局开机存储认证信息 下 ...