asp.net - IIS 找不到带有主题的有效证书
问题描述
我在本地 IIS 服务器上部署了带有 Identity Server 选项的 ASP.NET Angular SPA 模板 RC2 应用程序。我得到以下异常。IIS 无法访问我的本地认证信息。
Application: w3wp.exe
CoreCLR Version: 6.0.21.52210
.NET Version: 6.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException: Couldn't find a valid certificate with subject 'CN=my-subdomain.azurewebsites.net' on the 'CurrentUser\My'
at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.SigningKeysLoader.LoadFromStoreCert(String subject, String storeName, StoreLocation storeLocation, DateTimeOffset currentTime)
at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.LoadKey()
at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.Configure(ApiAuthorizationOptions options)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderConfigurationExtensions.<>c.<AddClients>b__8_1(IServiceProvider sp)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
我通过创建证书
New-SelfSignedCertificate -DnsName "my-subdomain.azurewebsites.net" -CertStoreLocation "cert:\CurrentUser\My"
我将 appsettings.json 设置为
"IdentityServer": {
"Key": {
"Type": "Store",
"StoreName": "My",
"StoreLocation": "CurrentUser",
"Name": "CN=my-subdomain.azurewebsites.net"
},
"Clients": {
"MarketPlace": {
"Profile": "IdentityServerSPA"
}
}
当我使用与文件夹发布相同的配置发布此站点时,它可以正常工作。如何修复 IIS 错误以便它可以访问证书?
解决方案
推荐阅读
- javascript - 仅使用 DIV 在 JavaScript 中制作时钟
- neo4j - Neo4j:更新现有节点之间的关系
- android - ARCore 1.2 Unity 即时创建 AugmentedImageDatabase
- ios - 解析服务器每次保存时都会创建一个新条目
- php - 尝试使 PDO 执行工作时出错
- python-3.x - 代码需要很长时间才能提出解决方案
- javascript - 使用 Bootstrap 4,如何在移动/平板电脑视图中折叠侧边栏
- php - 是什么导致 Session 值从插入的值发生变化?
- c# - C#用随机生成的字符串替换每个单词
- unit-testing - Karma-Jasmine:加载过程中出错