【问题标题】:IdentityServer4 discoveryDocument returns 404IdentityServer4 discoveryDocument 返回 404
【发布时间】:2022-02-06 04:49:38
【问题描述】:

我正在按照本教程设置 Ids4,我的步骤与视频相同,但是当我导航到 https://localhost:5443/.well-known/openid-configuration 时,我得到了 404。 我做过的事情:

  • 创建了一个新的Web APP -添加了 IdentityServer4 nuget 包 - 编辑启动如下:

公共类启动 {

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddIdentityServer()
            .AddInMemoryClients(new List<Client>())
            .AddInMemoryIdentityResources(new List<IdentityResource>())
            .AddInMemoryApiResources(new List<ApiResource>())
            .AddInMemoryApiScopes(new List<ApiScope>())
            .AddTestUsers(new List<TestUser>())
            .AddDeveloperSigningCredential();
        
        services.AddControllersWithViews();
      
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        app.UseIdentityServer();
        app.UseAuthentication();
       

        app.UseStaticFiles();
        app.UseRouting();
        app.UseAuthorization();
        app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute());
    }
}

}

如果我导航到 localhost,它应该会显示一个 hello world,但发现文档会返回 404。关于原因有什么想法吗?

【问题讨论】:

    标签: asp.net-web-api identityserver4


    【解决方案1】:

    您的中间件顺序不正确。 Here's how it should be

    此外,要确定出了什么问题,您必须在 Visual Studio 输出窗口中检查错误

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-19
      • 2021-06-22
      • 2020-12-02
      • 1970-01-01
      • 1970-01-01
      • 2019-01-26
      • 1970-01-01
      • 2016-09-17
      相关资源
      最近更新 更多