Error de protección de la cadena de conexión de App.config
Me encuentro con un problema que tenía antes; No puedo encontrar mi referencia sobre cómo resolverlo.
Aquí está el problema. Ciframos la sección de cadenas de conexión en app.config para nuestra aplicación cliente usando el código a continuación:
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
El problema es que tuvimos una licencia de vendedor. La computadora portátil anterior se dirige a un nuevo vendedor y bajo el inicio de sesión del nuevo usuario, cuando intenta hacer esto, recibimos un error. El error es:
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