【发布时间】:2016-10-08 04:35:39
【问题描述】:
我正在使用 ASP.NET 5,在我的解决方案中,我有 Web API、Identity Server 和 Angular 2 项目,并且我正在使用 Identity Server 对 Angular 2 客户端进行身份验证,Angular 2 客户端通过在 http 请求中传递令牌来使用 Web api 和web api 验证令牌并给出响应,为此我编写了一个自定义属性来检查用户是否经过身份验证
当我使用 API 时,出现以下异常,Web API 返回 500 内部服务器错误。
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 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) 在 System.Net.ServicePoint.ConnectSocketInternal(布尔连接失败, Socket s4, Socket s6, Socket&socket, IPAddress&地址, ConnectSocketState 状态、IAsyncResult asyncResult、Exception& 例外)
【问题讨论】:
-
您的 webapi 是否有权访问身份服务器?即你可以从 webapi 环境中点击 URL /.well-know/openid-configuration 吗?
-
感谢回复,是的
-
我们创建了一个使用“/.well-know/openid-configuration” URL 获取配置的 api 方法。如果我们尝试直接从浏览器以及其他应用程序(使用 jquery ajax get 调用)访问此 api 方法,它会给我们适当的响应
-
系统上是否配置了代理?当应用程序部署到 IIS 时,它将无法访问用户配置的代理。您必须在 OpenIdConnectOptions.BackchannelHttpHandler 上进行设置
-
听起来服务器要么没有运行,要么你禁用了元数据端点。
标签: angular asp.net-core asp.net-web-api2 asp.net-core-mvc identityserver3