在UWP应用程序中获取证书无效错误

时间:2018-12-18 20:14:22

标签: uwp certificate identityserver4

我正在尝试从Identity Server实例获取令牌端点。目前,我有以下代码:

myArr: [
  { a: 'blah' },
  { a: 'blah2'},
  { a: 'blahN'}
],

如果我在控制台应用程序中运行此命令并输出端点:

var disco = await _httpClient.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest
{
    Address = "https://localhost:5501"                
});

工作正常。但是,如果我使用完全相同的代码并从UWP桌面应用程序运行它,则会收到错误消息:

Console.WriteLine($"Endpoint: {disco.TokenEndpoint}");

深入了解内部异常似乎是证书错误:

Error connecting to https://localhost:5501/.well-known/openid-configuration: 
An error occurred while sending the request.

如果我手动导航到     https://localhost:5501/.well-known/openid-configuration 这样我就可以看到文档了。

在Identity Server中,我使用的是这个

The text associated with this error code could not be found.

The certificate authority is invalid or incorrect

我不明白为什么我从UWP应用程序中收到此错误;据我了解,Visual Studio安装会处理它所需的证书颁发机构。但是我真正不明白的是为什么它可以在控制台应用程序而不是台式机应用程序中工作。

1 个答案:

答案 0 :(得分:0)

对于您的问题,您需要为uwp项目添加EnterpriseAuthentication PrivateNetwork Shared User Certificates访问功能。有关更多详细信息,请参阅app capability declarations官方文档。

相关问题