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

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

问题描述

我正在使用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/.well-known/openid-configuration ". ---> System.IO.IOException:IDX10804:无法从以下位置检索文档: ' http://xx.xx.xx.x:3926/.well-known/openid-configuration ". ---> System.AggregateException:发生一个或多个错误. ---> System.Net.Http.HttpRequestException:发送时发生错误 请求. ---> System.Net.WebException:无法连接到 远程服务器---> System.Net.Sockets.SocketException:连接 尝试失败,因为关联方未正确响应 一段时间后,或由于以下原因建立的连接失败 连接的主机在以下位置无法响应xx.xx.xx.x:3926 System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)位于 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, 插槽s4,插槽s6,插槽&套接字,IPAddress&地址, 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)

推荐答案

如果Identityserver和访问令牌验证中间件托管在同一应用程序中,则启动时会出现竞争状况.

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.

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

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