Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

Can anyone please help me?

XML
- <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
- <s:Body>
- <s:Fault>
  <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">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="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <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>
  <Type>System.Configuration.ConfigurationErrorsException</Type>
  </InnerException>
  <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>
  <Type>System.Configuration.ConfigurationErrorsException</Type>
  </ExceptionDetail>
  </detail>
  </s:Fault>
  </s:Body>
  </s:Envelope>


Many thanks in advance.
Kind regards,
Posted
Updated 16-Sep-20 11:48am
v2
Comments
Abhishek Pant 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 asp.net applications also). I used to run the following commands to resolve it. Not sure whether it will help you, but please give a try.

VB
aspnet_regiis -pc "NetFrameworkConfigurationKey" -exp
aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"
aspnet_regiis -pa "NetFrameworkConfigurationKey" "NETWORK SERVICE"
aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT AUTHORITY\NETWORK SERVICE"
 
Share this answer
 
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,
 
Share this answer
 
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.
 
Share this answer
 
actually you need to add that user(under which website is running) in ACL
by following command
aspnet_regiis -pa "NetFrameworkConfigurationKey" "UserName"
 
Share this answer
 
Comments
Bhanu Pratap Verma 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900