本地 IP 的自签名 SSL 证书

问题描述

由命令 dotnet dev-certs https --trust 创建的开发证书有效。我想在我的局域网中为本地 IP 创建一个自签名证书。 我已经通过命令创建了一个自签名证书:

New-SelfSignedCertificate -NotBefore (Get-Date) -NotAfter (Get-Date).AddYears(2) -Subject "192.168.1.100" -KeyAlgorithm "RSA" -KeyLength 2048 -HashAlgorithm "SHA256" -CertStoreLocation "Cert:\LocalMachine\My" -KeyUsage KeyEncipherment -FriendlyName "HTTPS development certificate" -TextExtension @("2.5.29.19={critical}{text}","2.5.29.37={critical}{text}1.3.6.1.5.5.7.3.1","2.5.29.17={critical}{text}DNS=192.168.1.100")

然后我在证书存储中的受信任文件夹中复制了证书:

enter image description here

在此之后我编辑了 appsettings.Development.json:

"Kestrel": {
"Endpoints": {
  "localhostHttp": {
    "Url": "http://192.168.1.100:5000"
  },"localhostHttps": {
    "Url": "https://192.168.1.100:5001","Certificate": {
      "Subject": "192.168.1.100","Store": "Root","Location": "CurrentUser","AllowInvalid": true
    }
  }
}

但没有结果:

enter image description here

可以创建这样的证书吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)