Monday, June 11, 2007

Error : 'RSA key container could not be opened.'

This error occurs if the user does not have the right to access the key container.

Use following command to give permission to the web suer a/c "ASPNET"

aspnet_regiis -pa "Key Container Name" "ASPNET"

Like - aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"

Note -Key container name could be found in the machine.config file under configProtectedData section.

Path of machine.config file is %WinDir%\Microsoft.Net\Framework\v2.0\Config

12 comments:

Anonymous said...

it worked...thanks...

Anonymous said...

you are the man! was banging my head for 2 hours until i found this...

Anonymous said...

Thanks!!!

Shashi said...
This comment has been removed by the author.
Shashi said...

I am getting this error in w2k8 server.
I have given access to "ASPNET", "NETWORKSERVICE" but no luck.
I am using aspnet_regiis.exe utility which is available at Framework64 folder to import and export container.
Web.config file is actually encrypted on w2k3 server and we are migrating application on w2k8 server using MS Deploy. After migration when we browse application on w2k8 server. I am getting this error.
Please help me out...

Thanks in advance!!
Shashi

sanjay saini said...

Hi Shashi, make sure your application running under correct identity. use following code in your application to check -

Response.Write(WindowsIdentity.GetCurrent().Name);

and then grant permission using following utility-
aspnet_regiis -pa "NetFrameworkConfigurationKey" "< identity >"

Anonymous said...

This really worked...Thanks Sanjay

Anonymous said...

You kick ass !!!

Vincent said...

Too bad I am still getting the same thing as RSA key container could not be opened.

Response.Write(WindowsIdentity.GetCurrent().Name);Response.Write(WindowsIdentity.GetCurrent().Name);

How could I insert the above actually to know whats my identity?

Anonymous said...

I am trying to assign rights using the aspnet_reg.exe -pa " key name" "ASPNET" command and that is where I get the error that the RSA key container was not found. I went to the Machine.config for the key container name.

Any ideas??

sanjay saini said...

What is the command you are giving...?

Nandish Sargur said...

Hi,

I have tried above command with admin permission on command prompt but still facing the same error saying Container not found. pls help me

Thanks
Nandish