无法识别的属性 configProtectionProvider的解决方案

用RsaProtectedConfigurationProvider加密数据库连接字符串时,只要App.config有任何改动,都会提示无法识别的属性 configProtectionProvider。

只需要把刷新节点改成刷新配置文件就可以解决:



ConfigurationManager.RefreshSection("connectionStrings");

改成

ConfigurationManager.RefreshSection("configuration");