我有一个身份服务器,一个Web和一个前端应用程序。通常情况下,它们在本地主机上运行,工作正常。现在我需要在本地IP地址上运行这个应用程序。我将所有设置从localhost:port更改为:port,并在Web中得到以下错误:
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中切换
以下是我尝试加载证书的方式:
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的自签名证书,但是它没有帮助。
当前错误:
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.发布于 2021-03-23 15:34:03
当您尝试使用IP地址连接到服务时,不能使用HTTPS和证书。您必须始终具有本地计算机信任的域名和有效证书。
https://stackoverflow.com/questions/66765294
复制相似问题