我的 IS4 使用自签名证书。我按照此处中的步骤进行操作。
我尝试使用自签名证书并上传 pfx 文件。
New-SelfSignedCertificate -Subject "CN=certName" -CertStoreLocation "cert:LocalMachine\My"
appsettings.json 中包含以下内容:
"IdentityServer": { "Key": { "Type": "Store", "StoreName": "My", "StoreLocation": "CurrentUser", "Name": "CN=certName" } }
如文档中所述,我通过将配置
WEBSITE_LOAD_CERTIFICATES
设置为上传证书的指纹,将证书附加到 Web 应用程序。将其设置为 *
也没有帮助。这与来自 Azure KeyVault 的证书相同。
但是,从日志来看,Web 应用程序/IdentityServer 似乎无法获取给定主题的证书。
System.InvalidOperationException: Couldn't find a valid certificate with subject 'CN=certName' on the 'CurrentUser\My'
。应用程序无法启动并抛出 503。
我使用Duende,它是IdentityServer的最新版本。我错过了什么吗?
该问题与用于 Web 应用程序的 Linux VM 有关。我使用的 IdentityServer Key 值适用于 Windows,在 Linux 中不起作用。
我从这里
得到了答案我用这个代替:
"Key": {
"Type": "File",
"FilePath": "/var/ssl/private/ThumbprintValueHERE.p12",
"Password": ""
}