Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

IDX20803: Unable to obtain configuration from: 'https://[publicIP]/.well-known/openid-configuration'. #3039

Closed
vjarora opened this issue Feb 15, 2019 · 10 comments
Labels

Comments

@vjarora
Copy link

vjarora commented Feb 15, 2019

I am facing the same issue, environment is deployed in IIS in 3 different site
-Angular App
-IdentityServer4
-WebAPI - ASP.Net Core 2.1
and working fine on localhost and in Intranet, but when I am exposing it to Internet then it is giving the following issue.
{
"Code": 123,
"HttpCode": 500,
"Message": "Error",
"Description": "IDX20803: Unable to obtain configuration from: 'https://[publicIP]/.well-known/openid-configuration'.

inner exception : System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://[publicIP]/.well-known/openid-configuration'. ---> System.Net.Http.HttpRequestException: 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 ---> 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\r\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask)\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)\r\n at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\r\n at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)\r\n at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)\r\n at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel)

stack trace : at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel)\r\n at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.AuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)\r\n at IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler.HandleAuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)\r\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)\r\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)\r\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)"
}

@brockallen
Copy link
Member

I have a feeling it's a HTTPS issue, and completely unrelated to IdentityServer.

@vjarora
Copy link
Author

vjarora commented Feb 15, 2019

Everything is working fine on local environment, but in production server I am trying to get the certificate with X509 to AddSigingingCredential method. We have generated this with Let's Encrypt.

I am not sure but do we have any way wherein we can ignore certificate and use any other way to sign the token key.

@HenrikWM
Copy link
Contributor

Sounds like a failure to complete the HTTPS/TLS-handshake. Its not an IdentityServer-issue in that case, but an issue with how the HTTP-request between client and server is setup. Perhaps you're missing a client certificate on the HTTP-request from your client-app?

Enable network-tracing in your client-app and you'll find the answer in the verbose socket-logs that are generated when the GET-request fails.

@vjarora
Copy link
Author

vjarora commented Feb 21, 2019

{
"Code": 123,
"HttpCode": 500,
"Message": "Error",
"Description": "IDX20803: Unable to obtain configuration from: 'http://[[publicIP]]/.well-known/openid-configuration'. inner exception : System.IO.IOException: IDX20804: Unable to retrieve document from: 'http:[[publicIP]]/.well-known/openid-configuration'. ---> System.Net.Http.HttpRequestException: No such host is known ---> System.Net.Sockets.SocketException: No such host is known\r\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask)\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)\r\n at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\r\n at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)\r\n at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)\r\n at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) stack trace : at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel)\r\n at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.AuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)\r\n at IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler.HandleAuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()\r\n at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)\r\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)\r\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)\r\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)"
}

@vjarora
Copy link
Author

vjarora commented Feb 21, 2019

Still trying to resolve it, now it is giving above issue. I am also using public certificate now

@HenrikWM
Copy link
Contributor

«System.Net.Sockets.SocketException: No such host is known» means the hostname cannot be reached, i.e. the client code can’t open a socket to the IP you’re using. Can you open the url in a browser? If it’s a public IP then that should work, otherwise it’s due to network or maybe a wrong IP.

@vjarora
Copy link
Author

vjarora commented Feb 22, 2019

Thanks Henrik, yes I can access everything in browser, even this discovery document. Everything is working fine on dev machine and in on Intranet staging environment. But I am still not understanding what is stopping... every port is open also..., Not able to find out the reason.

@vjarora
Copy link
Author

vjarora commented Feb 22, 2019

Thanks, now everything is working fine, issue was that machine internal IP was not mapped with DNS name. Machine was not able to open the port because it was not understanding which IP need to be call. An entry of mapping done in "hosts" file.

Please close the issue.

@vjarora
Copy link
Author

vjarora commented Feb 22, 2019

Closed

@vjarora vjarora closed this as completed Feb 22, 2019
@lock
Copy link

lock bot commented Jan 11, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants