我遇到了以前的问题;找不到我如何解决它的参考.
这是问题所在.我们使用以下代码为客户端应用程序加密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