【问题标题】:Unity section in .config file using Protected Configuration Provider.config 文件中的 Unity 部分使用受保护的配置提供程序
【发布时间】:2013-06-14 18:11:13
【问题描述】:

在我的应用程序配置中,我使用的是 RSA 保护的配置提供程序,当它与 connectionStrings 部分一起使用时一切正常,但在 app.config 中与 unity 部分一起使用时一切正常。每当我尝试拨打此电话时:

container.LoadConfiguration("MyManager");

我明白了;

Unrecognized attribute 'configProtectionProvider'. Note that attribute names are case-sensitive. 

加密后的App.Config:

<unity configProtectionProvider="RsaProtectedConfigProvider">
    <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
...

什么给了?

【问题讨论】:

    标签: c# unity-container app-config config rsaprotectedconfiguration


    【解决方案1】:

    想通了。保存后我错过了这个:

                    config.Save(ConfigurationSaveMode.Full);
                    ConfigurationManager.RefreshSection(sectionName);
    

    【讨论】:

      猜你喜欢
      • 2017-02-06
      • 2018-11-26
      • 2023-04-07
      • 2019-03-26
      • 2015-04-29
      • 1970-01-01
      • 2022-08-17
      • 1970-01-01
      • 2023-03-19
      相关资源
      最近更新 更多