Je suis confronté à un problème que j'avais auparavant; ne trouve pas ma référence sur la façon de le résoudre.App.config chaîne de connexion Erreur de protection
Voici le problème. Nous chiffrons pour notre code en utilisant l'application client sous la section chaînes de connexion dans le 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
La question est que nous avions un congé de vendeur. L'ancien ordinateur portable va à un nouveau vendeur et sous la connexion du nouvel utilisateur, quand il essaie de le faire, nous obtenons une erreur. L'erreur est:
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
Si vous utilisez Vista ou une version supérieure, assurez-vous que vous exécutez en tant qu'administrateur. –