【问题标题】:Error when requesting discovery dock ( HTTPS required)请求发现坞站时出错(需要 HTTPS)
【发布时间】:2019-01-18 10:58:30
【问题描述】:

我正在使用身份服务器 4。事实上它工作正常,一切正常。但是,当我尝试打电话时

var client = new HttpClient();
// discover endpoints from metadata
var disco = client.GetDiscoveryDocumentAsync(IDPBaseURL).Result;
it gives me error         
http://xxx.x.x.xx:8080/.well-known/openid-configuration: HTTPS required.

它在 Visual Studio 和本地 IIS 部署中运行。但是我只有在服务器上部署时才会遇到这个错误。

有什么想法吗?

【问题讨论】:

    标签: c# asp.net-core identityserver4 dotnet-httpclient


    【解决方案1】:

    我遇到了同样的问题,并通过更改发现文档请求的策略来解决它。

    var client = new HttpClient();
    var disco = await client.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest {
        Address = "http://xxx.xxx.x.xxx:xxxx",
        Policy =
        {
            RequireHttps = false
        }
    });
    

    【讨论】:

    • 谢谢!我正在阅读 IdentityServer4 快速入门,但遇到了困难。
    • 没错,我也是。
    【解决方案2】:

    http://xxx.x.x.xx:8080/.well-known/openid-configuration:需要 HTTPS。

    由于错误状态,请确保 IDPBaseURL 设置为 Https。

    例子

    var client = new HttpClient();
    var disco = client.GetDiscoveryDocumentAsync("https://xxx.x.x.xx").Result;
    

    【讨论】:

    猜你喜欢
    • 2018-04-02
    • 2014-04-15
    • 1970-01-01
    • 2021-05-10
    • 1970-01-01
    • 1970-01-01
    • 2021-04-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多