WCF Webconfig を暗号化してから、暗号化された Webconfig を実際の Webconfig ファイルに置き換えました。
現在、問題はプロジェクトが私のPCでのみ機能していないことです。他のシステムでは正常に機能します。
暗号化は次のように行われます。
string provider = "RSAProtectedConfigurationProvider"; // or "DataProtectionConfigurationProvider"
string section = "connectionStrings";
protected void EncriptionWebConfig()
{
System.Configuration.Configuration confg;
if (HttpContext.Current != null)
confg = WebConfigurationManager.OpenWebConfiguration("~");
else
confg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConfigurationSection confStrSect = confg.GetSection(section);
if (confStrSect != null)
{
confStrSect.SectionInformation.ProtectSection(provider);
confg.Save();
}
}
エラーは次のとおりです。
プロバイダー 'RsaProtectedConfigurationProvider' を使用して復号化できませんでした。プロバイダーからのエラー メッセージ: RSA キー コンテナーを開けませんでした