我遇到了以前遇到的问题;找不到我如何解决它的参考。App.config连接字符串保护错误
这是问题。我们加密在App.config的连接字符串部分为我们下面的使用客户端应用程序代码:
config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
If config.ConnectionStrings.SectionInformation.IsProtected = False Then
config.ConnectionStrings.SectionInformation.ProtectSection(Nothing)
' We must save the changes to the configuration file.'
config.Save(ConfigurationSaveMode.Modified, True)
End If
的问题是,我们有推销员离开。旧笔记本电脑正在去新的销售人员,并在新用户的登录下,当它试图做到这一点,我们得到一个错误。错误是:
Unhandled Exception: System.Configuration.ConfigurationErrorsException:
An error occurred executing the configuration section handler for connectionStrings. ---> System.Configuration.ConfigurationErrorsException: Failed to encrypt the section 'connectionStrings' using provider 'RsaProtectedConfigurationProvider'.
Error message from the provider: Object already exists.
---> System.Security.Cryptography.CryptographicException: Object already exists
如果您使用的是Vista或更高版本,请确保您以管理员身份运行。 – 2010-09-22 12:48:13