首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用户配置文件和HKLM注册表均不可用。使用短暂的密钥存储库。当应用程序退出时,受保护的数据将不可用

用户配置文件和HKLM注册表均不可用。使用短暂的密钥存储库。当应用程序退出时,受保护的数据将不可用
EN

Stack Overflow用户
提问于 2016-11-24 09:59:00
回答 1查看 10.3K关注 0票数 18

我有一个Asp.NET核心应用程序没有特别设置的DataProtection堆栈-只有AddMvc。虽然一切都在IISExpress/(Kestrel)上工作,但在IIS服务器上,我得到了以下错误:

代码语言:javascript
复制
11/23/2016 18:50:14:warn: Microsoft.AspNetCore.Session.SessionMiddleware[7]
      Error unprotecting the session cookie.
System.Security.Cryptography.CryptographicException: The key {6d00462a-ba7f-4f65-bb36-711605de93f2} was not found in the key ring.
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
   at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)
11/23/2016 19:27:34:warn: Microsoft.Extensions.DependencyInjection.DataProtectionServices[59]
      Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
11/23/2016 19:27:34:warn: Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository[50]
      Using an in-memory repository. Keys will not be persisted to storage.
11/23/2016 19:27:34:warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {27c3297d-c583-4de5-b619-489bfba62407} may be persisted to storage in unencrypted form.
11/23/2016 19:27:35:warn: Microsoft.AspNetCore.Session.SessionMiddleware[7]
      Error unprotecting the session cookie.
System.Security.Cryptography.CryptographicException: The key {3cbde8ae-2dba-4c84-ada3-20ba40bdff85} was not found in the key ring.
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
   at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)

它只发生在一些用户登录后,而不是每次。我尝试谷歌,但没有成功。

可能是第二台服务器上的某些IIS配置不同吗?谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-25 11:43:20

此问题源于IIS本身的一个错误,该错误可能被纠正,也可能没有得到纠正。为了解决这个问题,您需要编辑App以启用用户配置文件加载。一旦将App设置为加载应用程序池标识的用户配置文件,应用程序将有权按预期的方式对系统注册表进行读写。 原始文章

简而言之,确保应用程序池加载用户配置文件:

下载ps脚本或其.NET模拟这里,构建它并以管理方式运行它,如下所示:

代码语言:javascript
复制
ProvisionAutoGenKeys.exe NetCoreAppPool
票数 14
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40783170

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档