我的目标是我可以从 VS2022 (Kestrel) 启动我的 .Net Blazor Server 应用程序,使用我的开发机器的 IP 地址(所以不是 127.0.0.1 或本地主机)但我的有效机器 IP (172.23.110.47) 和我这样做时可以有正确的 HTTPS 连接。 我在 Powershell 中运行了以下命令
PS C:\windows\system32> New-SelfSignedCertificate -Subject "localhost" -TextExtension @("2.5.29.17={text}DNS=localhost&IPAddress=127.0.0.1&IPAddress=::1&IPAddress=172.23.110.47")
PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\MY
Thumbprint Subject
---------- -------
53E7417A264B229B4F52638B15433F7C09476224 CN=localhost
PS C:\windows\system32> $mypwd = ConvertTo-SecureString -String "ControlTech" -Force -AsPlainText
PS C:\windows\system32> Get-ChildItem -Path cert:\localMachine\my\53E7417A264B229B4F52638B15433F7C09476224 | Export-PfxCertificate -FilePath C:\temp\MyJpfCertificate.pfx -Password $mypwd
Verzeichnis: C:\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 21.03.2023 09:05 2685 MyJpfCertificate.pfx
PS C:\windows\system32> dotnet dev-certs https --clean --import C:\Temp\MyJpfCertificate.pfx -p ControlTech
Cleaning HTTPS development certificates from the machine. A prompt might get displayed to confirm the removal of some of the certificates.
HTTPS development certificates successfully removed from the machine.
The certificate at 'C:\Temp\MyJpfCertificate.pfx' is not a valid ASP.NET Core HTTPS development certificate.
我找不到错误的解决方案 The certificate at 'C:\Temp\MyJpfCertificate.pfx' is not a valid ASP.NET Core HTTPS development certificate。我在哪里错过了什么?