首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >标识服务器4.使用自签名证书时出错

标识服务器4.使用自签名证书时出错
EN

Stack Overflow用户
提问于 2021-03-23 14:34:39
回答 1查看 1.1K关注 0票数 0

我有一个身份服务器,一个Web和一个前端应用程序。通常情况下,它们在本地主机上运行,工作正常。现在我需要在本地IP地址上运行这个应用程序。我将所有设置从localhost:port更改为:port,并在Web中得到以下错误:

代码语言:javascript
复制
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: '<my_ip>:5003/.well-known/openid-configuration'.
 ---> System.IO.IOException: IDX20804: Unable to retrieve document from: '<my_ip>:5003/.well-known/openid-configuration'.
 ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

我试图生成一个自签名证书并将其添加到证书存储区,我尝试了许多解决方案,例如this one。我所做的就是从这个错误和Keyset does not exist中切换

以下是我尝试加载证书的方式:

代码语言:javascript
复制
var key = Configuration["certBase64"]; // exported from store as x509 base64 encoded
                var pfxBytes = Convert.FromBase64String(key);
                var cert = new X509Certificate2(pfxBytes, "<certificate-pwd>", X509KeyStorageFlags.MachineKeySet);
                builder.AddSigningCredential(cert);

我遗漏了什么?

更新

我还试图为我的IP使用本地DNS名称。在我的路由器上,我设置了从myapp.local到的转发。然后,我创建了一个带有Subject和DNS名称= myapp.local的自签名证书,但是它没有帮助。

当前错误:

代码语言:javascript
复制
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'myapp.local:5003/.well-known/openid-configuration'.
 ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'myapp.local:5003/.well-known/openid-configuration'.
 ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-23 15:34:03

当您尝试使用IP地址连接到服务时,不能使用HTTPS和证书。您必须始终具有本地计算机信任的域名和有效证书。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66765294

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档