doo*_*deb 5 c# .net-core asp.net-core
我们有一个 net6.0 应用程序,将数据保护服务配置为持久保存到 sql。我可以看到在数据库中创建的关键记录,但在每个请求中,日志中至少有 8-9 个此类错误,而且每个孩子都是不同的。我认为数据保护服务的全部要点是,它应该使用持久的密钥进行保护,然后使用相同的密钥取消保护。然后密钥每 90 天回收一次。对此有任何想法将不胜感激,因为它正在向我们的日志发送垃圾邮件。
取消对孩子 TheKid 的密钥保护时出错。
异常:System.Security.Cryptography.CryptographicException:在密钥环中找不到密钥 {TheKey}。
这已经在这里得到了回答:
您正在使用 Azure 应用服务吗?
Azure 应用服务在负载平衡器处终止 TLS,并从那里通过端口 80 上的 HTTP 与您的应用程序进行通信。
在此流程中,我的应用程序提供了一个配置文件,其中包含以“http”开头的链接。
当这些链接被 IdentityServer 使用时,它们会被浏览器阻止以混合 HTTP 和 HTTPS 请求。
其结果是,对“https://contoso.azurewebsites.net/.well-known/openid-configuration”的请求返回时带有链接到 http 的内容。
"issuer": "http://contoso.azurewebsites.net/",
"jwks_uri": "http://contoso.azurewebsites.net/.well-known/openid-configuration/jwks",
"authorization_endpoint": "http://contoso.azurewebsites.net/connect/authorize",
"token_endpoint": "http://contoso.azurewebsites.net/connect/token",
"userinfo_endpoint": "http://contoso.azurewebsites.net/connect/userinfo",
"end_session_endpoint": "http://contoso.azurewebsites.net/connect/endsession",
"check_session_iframe": "http://contoso.azurewebsites.net/connect/checksession",
"revocation_endpoint": "http://contoso.azurewebsites.net/connect/revocation",
"introspection_endpoint": "http://contoso.azurewebsites.net/connect/introspect",
"device_authorization_endpoint": "http://contoso.azurewebsites.net/connect/deviceauthorization",
"frontchannel_logout_supported": true,
"frontchannel_logout_session_supported": true,
"backchannel_logout_supported": true,
"backchannel_logout_session_supported": true,
"scopes_supported": [
"openid",
"profile",
"contoso.Web.ServerAPI",
"offline_access"
],
Run Code Online (Sandbox Code Playgroud)
如何在生产中将所有请求设置为 HTTPS:
if (!app.Environment.IsDevelopment())
{
app.Use((context, next) =>
{
context.Request.Scheme = "https";
return next(context);
});
}
Run Code Online (Sandbox Code Playgroud)