Click here to Skip to main content
11,496,146 members (635 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: C# Silverlight
Hi all,

I have a Silverlight application, that makes use of it's web.config file to get it's conneciton string. The connection string has be encrypted with RSA utility that runs on the same machine. I receive the following exception each time I run the Silerlight application. Strange thing is that it works with another Silverlight application that runs of the same PC Confused | :confused:

Can anyone please help me?

- <s:Envelope xmlns:s="">
- <s:Body>
- <s:Fault>
  <faultcode xmlns:a="">a:InternalServiceFault</faultcode>
  <faultstring xml:lang="en-US">Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened. (C:\inetpub\wwwroot\CustomQuotes\web.config line 18)</faultstring>
- <detail>
- <ExceptionDetail xmlns="" xmlns:i="">
  <HelpLink i:nil="true" />
- <InnerException>
  <HelpLink i:nil="true" />
  <InnerException i:nil="true" />
  <Message>The RSA key container could not be opened.</Message>
  <StackTrace>at System.Configuration.RsaProtectedConfigurationProvider.ThrowBetterException(Boolean keyMustExist) at System.Configuration.RsaProtectedConfigurationProvider.GetCryptoServiceProvider(Boolean exportable, Boolean keyMustExist) at System.Configuration.RsaProtectedConfigurationProvider.Decrypt(XmlNode encryptedNode) at System.Configuration.ProtectedConfigurationSection.DecryptSection(String encryptedXml, ProtectedConfigurationProvider provider) at System.Configuration.Internal.DelegatingConfigHost.DecryptSection(String encryptedXml, ProtectedConfigurationProvider protectionProvider, ProtectedConfigurationSection protectedConfigSection) at System.Configuration.RuntimeConfigurationRecord.CallHostDecryptSection(String encryptedXml, ProtectedConfigurationProvider protectionProvider, ProtectedConfigurationSection protectedConfig) at System.Configuration.BaseConfigurationRecord.DecryptConfigSection(ConfigXmlReader reader, ProtectedConfigurationProvider protectionProvider)</StackTrace>
  <Message>Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened. (C:\inetpub\wwwroot\CustomQuotes\web.config line 18)</Message>
  <StackTrace>at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Web.HttpContext.GetSection(String sectionName) at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at System.Configuration.ConfigurationManager.get_ConnectionStrings() at CustomQuoteDashboard.Web.DataClassesDataContext..ctor() in C:\Development\Applications\Dashboards\CustomQuoteDashboard\CustomQuoteDashboard.Web\DataClasses.designer.cs:line 78 at CustomQuoteDashboard.Web.DataService.Authentication() in C:\Development\Applications\Dashboards\CustomQuoteDashboard\CustomQuoteDashboard.Web\DataService.svc.cs:line 26 at SyncInvokeAuthentication(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>

Many thanks in advance.
Kind regards,
Posted 24-Mar-10 3:54am
Edited 13-Apr-10 20:52pm
Abhishek Pant at 7-Feb-13 2:05am
Does the problem is solved? If not then change your subject as it says some text about[solved].If yes please post your solution here.
I used to get the same error when Web.config was encrypted (for applications also). I used to run the following commands to resolve it. Not sure whether it will help you, but please give a try.

aspnet_regiis -pc "NetFrameworkConfigurationKey" -exp
aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"
aspnet_regiis -pa "NetFrameworkConfigurationKey" "NETWORK SERVICE"
aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT AUTHORITY\NETWORK SERVICE"
I fixed the problem by using the following steps:

1. First of all, I was working on Windows Server 2008
2. Open IIS
3. Navigate to the web site that is causing the problem
4. Under Security within the Home section of the web site, click on the 5. Authentication icon
6. Disable ASP.NET impersonation

Kind regards,
Hi All,

I am getting error "RSA Key container was not found" when I run the command
"aspnet_regiis -pa "Container Name" "NT AUTHORITY\IUSR" as a administrator.

Please help , Its very urgent and highly appreciated.
actually you need to add that user(under which website is running) in ACL
by following command
aspnet_regiis -pa "NetFrameworkConfigurationKey" "UserName"
Bhanu Raja at 10-Nov-14 2:21am
Hi ,

I am getting error "RSA Key container was not found" when I run the command
"aspnet_regiis -pa "Container Name" "NT AUTHORITY\IUSR" as a administrator.

Please help , Its very urgent and highly appreciated.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 RyanDev 230
1 Sergey Alexandrovich Kryukov 114
2 Richard Deeming 100
3 OriginalGriff 89
4 Mostafa Asaduzzaman 59
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 10 Nov 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100