'The RSA key container could not be opened
I've been developing an ASP.NET site on an older machine running XP home. I recently got a new Win 7 PC and moved all my project files across. When I try and run the project, I get this error message:
"Failed to decrypt using provider 'MyRsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened."
I realised that I encrypted parts of my web.config file using a RSA encryption. This is where the problem now lies. I'm not sure how to get that key working again so that I can use it on my new machine. I exported the key from the older machine and imported it using:
aspnet_regiis -pi "RSAProviderName" "C:\RSA_configkey.xml"
This was imported successfully. I then ran the project, but the same error message came up. I figured it might be a permission thing, so I ran:
aspnet_regiis -pa "RSAProviderName" "\Desktop" -full
This was also successful, but I still get the error. From reading around, I've seen people use "ASPNET" instead of "\Desktop" (Desktop is my machine name). However, when I try and use "ASPNET", I get:
No mapping between account name and security IDs was done. <Exception from HRESULT = 0x80070534
I can't work on the project until this is fixed, so any help is much appreciated. Thanks!
Solution 1:[1]
I was facing the same issue, But running the commandprompt/powershell using administrator resolved the issue.
Solution 2:[2]
In my case, Visual Studio should be executed AS Administrator; Otherwise it cannot open the RSA Keys container.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sachin Vishwakarma |
| Solution 2 | Roger |
