我正在使用 ASP.Net 核心 1 而不是 2,并尝试在我的系统上运行 OpenIdDict 示例。我做了一些小改动,使项目可以为我构建。但是我在调试时出错,不知道如何处理。有人对我有想法/提示吗?非常感谢!
System.InvalidOperationException:尝试激活“AuthorizationServer.Startup”时无法解析“Microsoft.Extensions.Configuration.IConfiguration”类型的服务。在 Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) 在 Microsoft.AspNetCore.Hosting.Internal.StartupLoader.LoadMethods(IServiceProvider services, Type startupType, String environmentName) 在 Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass1_0 .b__1(IServiceProvider sp) at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider,
程序.cs
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace AuthorizationServer
{
public static class Program
{
public static void Main(string[] args)
{
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder()
.ConfigureLogging(options => options.AddConsole())
.ConfigureLogging(options => options.AddDebug())
.UseConfiguration(configuration)
.UseIISIntegration()
.UseKestrel()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
沧海一幻觉
相关分类