我试图运行IdentityServer4作为控制台应用程序。但我不确定我是否正确。我创建控制台应用程序(.NET核心)代替ASP.NET核心的Web应用程序(.NET核心)。IdentityServer 4作为控制台应用程序
我的WebHostBuilder
设置是相当简单:
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
另外,启动类是非常小的:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients())
.AddTestUsers(Config.GetUsers());
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
app.UseIdentityServer();
}
}
我只是担心,如果我错过了一些作品可能以后会导致问题。我是否正确?
是的,这是真的,我的观点是运行_IdentityServer_作为_ * .exe_。我可以_ASP.Net Core_模板做到这一点?哦,并感谢您使用'UseContentRoot'提示。这种设置的含义是什么? –
当你定位完整的框架时,你会得到一个exe文件 - netcore将总是生成一个你可以用dotnet运行的dll。 – leastprivilege