angular - 无法从 well-known/openid-configuration 获取配置

标签 angular asp.net-core asp.net-web-api2 asp.net-core-mvc identityserver3

我正在使用 ASP.NET 5,在我的解决方案中,我有 Web API、Identity Server 和 Angular 2 项目,我正在使用 Identity Server 对 Angular 2 客户端进行身份验证,Angular 2 客户端通过在 http 请求中传递 token 来使用 Web API,并且web api 验证 token 并给出响应,为此我编写了一个自定义属性来检查用户是否已通过身份验证

当我使用 API 时出现以下异常并且 Web API 返回 500 内部服务器错误。

System.InvalidOperationException: IDX10803: Unable to obtain configuration from: 'http://xx.xx.xx.x:3926/.well-known/openid-configuration'. ---> System.IO.IOException: IDX10804: Unable to retrieve document from: 'http://xx.xx.xx.x:3926/.well-known/openid-configuration'. ---> System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xx.xx.xx.x:3926 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

最佳答案

如果身份服务器和访问 token 验证中间件托管在同一应用程序中,则在启动时会出现竞争条件。

验证中间件尝试加载尚不可用的发现文档。

在这些情况下,将验证中间件上的 DelayLoadMetadata 标志设置为 true。

如果您完全禁用发现端点,则需要在验证选项上配置颁发者和 key Material 。

关于angular - 无法从 well-known/openid-configuration 获取配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37693516/

相关文章:

sql - EF 核心代码优先迁移自动为表添加 db_owner 前缀

c# - 尽管线程池中有足够的线程,但请求仍在 Azure AppService 中排队

.net - Web API 2 使用现有访问 token 注册外部帐户

d3.js - d3.selection.prototype 使用 typescript 和 angular 2 抛出错误

Angular 5/Typescript/RxJS - 从 Observable 获取数据

javascript - 如何在使用公共(public)文件夹的 Webhost 上组织 Angular 2 文件?

c# - ASP.NET Core线程中默认的IServiceProvider安全吗?

c# - Dotnet 使用 graphQL 客户端,数据响应未映射

jquery - Web Api 仅允许提交表单一次

AngularFire2检索不订阅更改(Firestore)