The RSA key container could not be opened.

Posts   
 
    
jds4peace
User
Posts: 12
Joined: 16-Nov-2006
# Posted on: 01-Feb-2007 20:25:11   

When I run my project (ASP.NET 2.0) via the default web server (not IIS) everything is fine. When I switch the project to use IIS I get:

"The RSA key container could not be opened"

being thrown by the DataAcessAdapter constructor (no parameters) in the execution of a stored procedure call (LLBLGEN generated)...

  1. Why is LLBLGEN trying to decrypt my web.config file (its not encrypted)

  2. Anyone have a quick workaround for this? I've tried setting the IIS user to ASPNET...no luck...

Thanks in advance for any help...

~JDS

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39897
Joined: 17-Aug-2003
# Posted on: 01-Feb-2007 21:59:08   

You use impersonation?

None of the llblgen pro classes do any en/decryption.

Frans Bouma | Lead developer LLBLGen Pro
jds4peace
User
Posts: 12
Joined: 16-Nov-2006
# Posted on: 02-Feb-2007 16:40:58   

I'm not using impersonation.

This is where its happening in dataaccessadapter...

private string ReadConnectionStringFromConfig() { return ConfigFileHelper.ReadConnectionStringFromConfig( DataAccessAdapter.ConnectionStringKeyName); }

throws:

{"Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened. (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config line 15)"}

what i noticed this time is that the rest of my code is reading from the correct web.config file, but it looks like the llblgen ConfigHelper is trying to read from the root web.config file...

so i open that file up and lo and behold somehow I've got an encrypted ConnectionString section in there! So i delete that section and it is fine now...I guess ConnectionString must be one of the sections that you can't override...

I finally remembered how i might have ended up with the encrypted ConnectionString section...I was messing around with encrypting the web.config at runtime via the Global.asax file and I must have screwed up the path at some point and accidentally wrote that section out to the root web.config...

Super weird bug...kinda funny really.

Sorry to waste your time...

~JDS