Azure Web Api Jwt-无法获取配置套接字禁止

Azure Web Api Jwt-无法获取配置套接字禁止,jwt,identityserver4,azure-web-app-service,asp.net-core-2.2,Jwt,Identityserver4,Azure Web App Service,Asp.net Core 2.2,拥有一个Asp.Net Core 2.2.1 Web Api,该Api正在尝试获取OpenId配置,以便能够对请求进行身份验证。权威网站恰好是IdentityServer4 /.well-known/openid配置看起来正确,api站点正在运行,不安全的api方法工作正常 在Kudu中查看日志时,我看到以下错误。似乎是由插座问题引起的,但我不知道这里出了什么问题 在我的开发机器上,所有这些都可以在本地正常工作,那么Azure缺少/需要什么呢 System.IO.IOException: IDX

拥有一个Asp.Net Core 2.2.1 Web Api,该Api正在尝试获取OpenId配置,以便能够对请求进行身份验证。权威网站恰好是IdentityServer4

/.well-known/openid配置看起来正确,api站点正在运行,不安全的api方法工作正常

在Kudu中查看日志时,我看到以下错误。似乎是由插座问题引起的,但我不知道这里出了什么问题

在我的开发机器上,所有这些都可以在本地正常工作,那么Azure缺少/需要什么呢

System.IO.IOException: IDX20804: Unable to retrieve document from: '[PII is hidden]'. ---> 
System.Net.Http.HttpRequestException: An attempt was made to access a socket
in a way forbidden by its access permissions --->
完整的错误细节

2019-01-11 11:07:43.096 +00:00 [Error] Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler: Exception occurred while processing message.
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: '[PII is hidden]'. ---> System.IO.IOException: IDX20804: Unable to retrieve document from: '[PII is hidden]'. ---> System.Net.Http.HttpRequestException: An attempt was made to access a socket in a way forbidden by its access permissions ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
   --- End of inner exception stack trace ---
   at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
   at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
   at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
   --- End of inner exception stack trace ---
   at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()

经过数小时的调试和开机

IdentityModelEventSource.ShowPII = true;    //show detail of error and see problem
要查看众所周知的配置的问题,我看到它没有从Azure门户获取应用程序设置

由于我的设置是嵌套的,我只需要确保Azure刀片中的密钥匹配

i、 e

变成

AppSettings:ApiUrl

简单错误。将.UseAzureAppServices()添加到WebHost builder中似乎解决了套接字问题-不确定这到底是什么作用,但现在我刚刚收到错误消息无法获取配置信息IDX20803:无法从以下位置获取配置:“[PII隐藏]”。因此,它似乎很难找到/.well/openid配置url。如何取消隐藏隐藏的PII?如果我在Chrome、IE等浏览器中浏览到该配置,则该配置看起来具有正确的uri。确定它在尝试查找已知配置时会选择localhost。
AppSettings:ApiUrl