Using an in-memory repository. Keys will not be persisted to storage.问题

记录一个问题:

2020-04-13 15:26:18.3489|Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository|WARN|Using an in-memory repository. Keys will not be persisted to storage.

2020-04-13 15:26:18.3577|Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager|WARN|Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.

2020-04-13 15:26:18.3577|Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager|WARN|No XML encryptor configured. Key {ae3c6013-0afe-4b65-a66a-f1b52b652685} may be persisted to storage in unencrypted form.

问题信息:
Using an in-memory repository. Keys will not be persisted to storage.
Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
No XML encryptor configured. Key {ae3c6013-0afe-4b65-a66a-f1b52b652685} may be persisted to storage in unencrypted form

出现时间(同事说的):
每次涉及到xml格式传输的接口就会报这个,iis配置没问题的样子。

在网上查到在 ASP.NET Core 中如果在 DataProtection 中使用了 PersistKeysToFileSystem 或 PersistKeysToFileSystem就会有这个警告。

原因:

看了很多文章,不管如何表达好像都和加密/数据保护/iis对netcore没变化等等,相关的。

 

iis的配置问题解决方案:

此问题源于IIS 本身中的错误,该错误可能得到纠正,也可能永远不会得到纠正。为了解决此问题,您需要编辑应用池以启用用户配置文件加载。将 App Pool 设置为加载应用程序池标识的用户配置文件后,应用程序将具有按预期读取和写入系统注册表的权限。

有帮助的文章:
https://www.puresourcecode.com/dotnet/net-core/using-an-in-memory-repository-keys-will-not-be-persisted-to-storage-asp-net-core-under-iis/
http://www.voidcn.com/article/p-wsixnuvn-buw.html
https://cypressnorth.com/programming/solved-using-memory-repository-keys-will-not-persisted-storage-asp-net-core-iis/

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值