App.config chaîne de connexion erreur de Protection

Je suis en cours d'exécution sur un problème que j'avais avant; ne peut pas trouver ma référence sur la façon de le résoudre.

Ici est la question. Nous chiffrons les chaînes de connexion dans la section de l'app.config pour notre client de l'application à l'aide du code ci-dessous:

        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

Le problème c'est que nous avions un vendeur de congé. Le vieux portable va à un nouveau vendeur et en vertu de la nouvelle session de l'utilisateur lorsqu'il tente 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 êtes sur Vista, ou au-dessus, assurez-vous que vous êtes en cours d'exécution en tant qu'administrateur.
InformationsquelleAutor MikeScott8 | 2008-09-03