无法从 well-known/openid-configuration 获取配置 [英] Unable to obtain configuration from well-known/openid-configuration

查看:197
本文介绍了无法从 well-known/openid-configuration 获取配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using ASP.NET 5, In my solution I have Web API, Identity Server and Angular 2 project and I am authenticating Angular 2 client by using Identity Server, Angular 2 client consumes web api by passing token in http request and web api authenticate token and gives response, for this I have written a custom attribute which checks that user is authenticated or not

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

When I consume API I am getting following exception and Web API returns 500 internal server error.

System.InvalidOperationException:IDX10803:无法获取配置来自:'http://xx.xx.xx.x:3926/.众所周知/openid 配置'.--->System.IO.IOException:IDX10804:无法从以下位置检索文档:'http://xx.xx.xx.x:3926/.众所周知/openid 配置'.--->System.AggregateException:发生一个或多个错误.--->System.Net.Http.HttpRequestException:发送时出错请求.---> System.Net.WebException: 无法连接到远程服务器---> System.Net.Sockets.SocketException:一个连接尝试失败,因为连接方没有正确响应一段时间后,或建立连接失败,因为连接的主机未能响应 xx.xx.xx.x:3926 atSystem.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) 在System.Net.ServicePoint.ConnectSocketInternal(布尔连接失败,Socket s4, Socket s6, Socket&套接字、IP地址&地址,ConnectSocketState 状态、IAsyncResult asyncResult、Exception&例外)

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)

推荐答案

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

If identityserver and the access token validation middleware are hosted in the same application there is a race condition at startup.

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

The validation middleware tries to load the discovery document, which is not yet available.

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

In these scenarios, set the DelayLoadMetadata flag on the validation middleware to true.

如果您完全禁用发现端点,则需要在验证选项上配置颁发者和密钥材料.

If you disable the discovery endpoint altogether, you need to configure the issuer and key material on the validation options.

这篇关于无法从 well-known/openid-configuration 获取配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆