📌  相关文章
📜  System.InvalidOperationException:无法解析类型“Microsoft.Extensions.Logging.ILogger”的服务 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:56.598000             🧑  作者: Mango

代码示例1
public void ConfigureServices(IServiceCollection services)
    {
        var serviceProvider = services.BuildServiceProvider();
        var logger = serviceProvider.GetService>();
        services.AddSingleton(typeof(ILogger), logger);
        ...
     }