5
目前我的身份服务器运行完美,但我想在其上添加一个API,以便通过Web前端进行一些数据库配置更改。文档中的示例显示了如何使用MVC执行此操作,但不显示WebAPI。如何在同一个项目中运行IdentityServer和WebAPI
的Startup.Configuration方法是这样的:
app.UseIdentityServer(new IdentityServerOptions{ ... });
...
app.Map("/api", apiApp =>
{
apiApp.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "https://localhost:44300", // URL of identity server
});
});
然而,当app.Map
被调用,它抛出一个错误,因为它无法到达服务器的身份,大概是因为它尚未开始。我怎样才能让他们一起合作?