gpt4 book ai didi

c# - App.config - 加密部分错误 :

转载 作者:数据小太阳 更新时间:2023-10-29 01:55:49 24 4
gpt4 key购买 nike

我有一个加密配置文件中的部分的应用程序。第一次尝试从配置文件中读取加密部分时,我收到一条错误消息:“无法识别的属性‘configProtectionProvider’。请注意,属性名称区分大小写。”

config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);  
// Get the section in the file.
ConfigurationSection section = config.GetSection("EncryptedSection");


if (section != null)
{
// Protect the section.
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
section.SectionInformation.ForceSave = true;

// Save the change.

config.Save(ConfigurationSaveMode.Modified);
}
ConfigurationManager.RefreshSection("EncryptedSection");
Properties.Settings.Default.Reset();

//This is the part where I read the encrypted section:

ConfigurationManager.RefreshSection("EncryptedSection");
System.Collections.IDictionary HSMMasterKeyConfig = (System.Collections.IDictionary)System.Configuration.ConfigurationManager.GetSection("EncryptedSection");

这只发生在我第一次尝试阅读加密部分时。我注意到 .config 文件在第一次保存后立即更新,但出于某种原因我需要重新启动应用程序才能使用加密部分。

最佳答案

你读完了吗...

http://bytes.com/groups/net/521818-configurationerrorexception-when-reading-protected-config-section

...因为它似乎是涉及 MSFT 支持工程师的对话,直接映射到您的情况。

关于c# - App.config - 加密部分错误 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/672157/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com