Home » Development » Solved: “Failed to decrypt using provider ‘RsaProtectedConfiguration Provider’. Error message from the provider: The RSA key container could not be opened”

Solved: “Failed to decrypt using provider ‘RsaProtectedConfiguration Provider’. Error message from the provider: The RSA key container could not be opened”

You may get this error when you visit your ASP.NET webpage:

Parser Error Message: Failed to decrypt using provider ‘RsaProtected ConfigurationProvider’. Error message from the provider: The RSA key container could not be opened.

You have probably just ecrypted connection strings in web.config. This error states that IIS wasn’t able to decrypt your connectiion string.

Resolution

Check your authentication settings first (Windows, Forms, Anonymous, Impersonation etc). Make sure you enable the ones you need.

If this doesn’t solve the issue, it means that you didn’t grant access to your ASP.NET user on RSA container. Open command prompt and run this command:

aspnet_regiis -pa "DemoWebsiteConfigurationKey" "NT Authority\Network Service"

Make sure you put the correct container name for DemoWebsiteConfigurationKey and default ASP.NET account instead of “NT Authority\Network Service”. To find out your container name, look for keyContainerName parameter in your web.config or machine.config (%windir%\Microsoft.NET\Framework\[version]\config\machine.config).

Many thanks to Diganta Kumar

Ned Sahin

Blogger for 20 years. Former Microsoft Engineer. Author of six books. I love creating helpful content and sharing with the world. Reach me out for any questions or feedback.

1 thought on “Solved: “Failed to decrypt using provider ‘RsaProtectedConfiguration Provider’. Error message from the provider: The RSA key container could not be opened””

Leave a Comment