I used RSA container key encryption for encrypting my appSettings in web.config. The encrypted web config works fine in Visual Studio when running in IIS Express. But when I change it to Local IIS in project properties(in VS 2015), I am getting the error
"Failed to decrypt using provider 'MyEncryptionProvider'. Error message from the provider: The RSA key container could not be opened.".
If the web config is decrypted, it works in Local IIS as well as IIS Express.
These are the commands I used:
aspnet_regiis.exe -pc MyCustomKeys -exp
aspnet_regiis.exe -pa MyCustomKeys "NT AUTHORITY\NETWORK SERVICE"
aspnet_regiis.exe -pef appSettings "D:\Demo\Encrypting configuration" -prov MyEncryptionProvider
configProtectedData
<configProtectedData>
<providers>
<add keyContainerName="MyCustomKeys"
useMachineContainer="true"
name="MyEncryptionProvider"
type="System.Configuration.RsaProtectedConfigurationProvider"/>
</providers>