GetDiscoveryDocumentAsync:"An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set."
GetDiscoveryDocumentAsync: "An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set."
我已经检查了 SO 上的大部分问题,但没有找到我的答案。
我正在尝试从身份服务器获取 JWT 令牌。
方法如下:
var discoveryDocument = new DiscoveryDocumentRequest
{
Address = "https://admin.blabla.app:5000/",
Policy =
{
RequireHttps = false
}
};
var auth = httpClient.GetDiscoveryDocumentAsync(discoveryDocument).Result;
我得到的错误是 An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set.
DiscoveryDocumentRequest
{
"Policy": {
"LoopbackAddresses": [
"localhost",
"127.0.0.1"
],
"Authority": "https://admin.blabla.app:5000",
"AuthorityValidationStrategy": {},
"RequireHttps": false,
"AllowHttpOnLoopback": true,
"ValidateIssuerName": true,
"ValidateEndpoints": true,
"EndpointValidationExcludeList": [],
"AdditionalEndpointBaseAddresses": [],
"RequireKeySet": true
},
"Address": "https://admin.blabla.app:5000/",
"ClientId": null,
"ClientSecret": null,
"ClientAssertion": {
"Type": null,
"Value": null
},
"ClientCredentialStyle": 1,
"AuthorizationHeaderStyle": 0,
"Parameters": [],
"Version": {
"Major": 1,
"Minor": 1,
"Build": -1,
"Revision": -1,
"MajorRevision": -1,
"MinorRevision": -1
},
"Content": null,
"Method": {
"Method": "GET"
},
"RequestUri": null,
"Headers": [
{
"Key": "Accept",
"Value": [
"application/json"
]
}
],
"Properties": {}
}
此代码在 windows 服务上。
有趣的事实:相同的代码在不同的 windows 机器上运行。为什么?可能是什么问题?
参考这篇sample请写:
var client = new HttpClient();
var disco = await client.GetDiscoveryDocumentAsync("https://admin.blabla.app:5000/");
if (disco.IsError)
{
Console.WriteLine(disco.Error);
return;
}
请检查您的 URL https://admin.blabla.app:5000/ your error is related to your URL you can test your code by https://demo.identityserver.io/
我已经检查了 SO 上的大部分问题,但没有找到我的答案。
我正在尝试从身份服务器获取 JWT 令牌。
方法如下:
var discoveryDocument = new DiscoveryDocumentRequest
{
Address = "https://admin.blabla.app:5000/",
Policy =
{
RequireHttps = false
}
};
var auth = httpClient.GetDiscoveryDocumentAsync(discoveryDocument).Result;
我得到的错误是 An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set.
DiscoveryDocumentRequest
{
"Policy": {
"LoopbackAddresses": [
"localhost",
"127.0.0.1"
],
"Authority": "https://admin.blabla.app:5000",
"AuthorityValidationStrategy": {},
"RequireHttps": false,
"AllowHttpOnLoopback": true,
"ValidateIssuerName": true,
"ValidateEndpoints": true,
"EndpointValidationExcludeList": [],
"AdditionalEndpointBaseAddresses": [],
"RequireKeySet": true
},
"Address": "https://admin.blabla.app:5000/",
"ClientId": null,
"ClientSecret": null,
"ClientAssertion": {
"Type": null,
"Value": null
},
"ClientCredentialStyle": 1,
"AuthorizationHeaderStyle": 0,
"Parameters": [],
"Version": {
"Major": 1,
"Minor": 1,
"Build": -1,
"Revision": -1,
"MajorRevision": -1,
"MinorRevision": -1
},
"Content": null,
"Method": {
"Method": "GET"
},
"RequestUri": null,
"Headers": [
{
"Key": "Accept",
"Value": [
"application/json"
]
}
],
"Properties": {}
}
此代码在 windows 服务上。
有趣的事实:相同的代码在不同的 windows 机器上运行。为什么?可能是什么问题?
参考这篇sample请写:
var client = new HttpClient();
var disco = await client.GetDiscoveryDocumentAsync("https://admin.blabla.app:5000/");
if (disco.IsError)
{
Console.WriteLine(disco.Error);
return;
}
请检查您的 URL https://admin.blabla.app:5000/ your error is related to your URL you can test your code by https://demo.identityserver.io/