Failed to encrypt the section 'connectionStrings' using provider 'RsaProtectedCo nfigurationProvider'. Error message from the provider: Object already exists.
I followed the guide in http://msdn.microsoft.com/en-us/library/2w117ede.aspx but in step 3 in To grant the ASP.NET identity access to the RSA key container, it says that my identity is my workgroup\username, I do not have impersonation in my web.config file though
I am encrypting web.config using my machine using asp_regiis, then using visual studio to debug then it came with this error
For using RsaProtectedConfigurationProvider you need to launch your Command prompt or Visual Studio as an Administrator.
For DataProtectionConfigurationProvider it is not required to run under Admin rights.
You can create your own provider using RsaProtectedConfigurationProvider to encrypt your web.xml without administrator privileges.
Create a key store:
aspnet_regiis -pc "MyKeyStore" -exp
Grant read access for any user:
aspnet_regiis -pa "MyKeyStore" "Domain/User"
Put a provider section in your web.config
<configProtectedData> <providers> <add name="MyRSAProvider" type="System.Configuration.RsaProtectedConfigurationProvider,System.Configuration, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"keyContainerName="MyKeyStore"useMachineContainer="true" /> </providers> </configProtectedData>
Encrypt your config sections:
aspnet_regiis -pef "configSection" "c:\pathToWebConf" -prov "MyRSAProvider"
Sources:
Create RSA key container and provider
Encrypt configuration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With