Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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="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 24-Mar-10 3:54am
Programm3r11.3K
Edited 13-Apr-10 20:52pm
v2
Comments
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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
 
aspnet_regiis -pc "NetFrameworkConfigurationKey" -exp
aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"
aspnet_regiis -pa "NetFrameworkConfigurationKey" "NETWORK SERVICE"
aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT AUTHORITY\NETWORK SERVICE"
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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,
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

actually you need to add that user(under which website is running) in ACL
by following command
aspnet_regiis -pa "NetFrameworkConfigurationKey" "UserName"
  Permalink  
Comments
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 Afzaal Ahmad Zeeshan 256
1 OriginalGriff 251
2 BillWoodruff 240
3 Maciej Los 230
4 Sergey Alexandrovich Kryukov 195
0 OriginalGriff 6,419
1 Sergey Alexandrovich Kryukov 6,008
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,070


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 10 Nov 2014
Copyright © CodeProject, 1999-2014
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