I have encrypted my WCF Webconfig, then I have replaced my encrypted webconfig with the actual webconfig file.
Now the problem is project is not working on my pc only, it works fine on other systems.
Encryption is done as follows:
string provider = "RSAProtectedConfigurationProvider"; // or "DataProtectionConfigurationProvider"
string section = "connectionStrings";
protected void EncriptionWebCon开发者_运维问答fig()
{
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();
}
}
Error is:
Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened
The RSA Container and Key are machine specific. Unless you export the container and key from the working machine to the non-working machine it will fail to open the key container. MSDN
精彩评论