以前に抱えていた問題に直面しています。それを解決する方法についての私の参照が見つかりません。
これが問題です。以下のコードを使用して、クライアント アプリケーションの 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