在过去的几天里,我一直被一个奇怪的问题所困扰。
尝试创建如下所示的 RSA 密钥容器时(来自 cmd 管理窗口):
aspnet_regiis -pc "MyKeyContainer" -exp
我收到以下错误:
正在创建 RSA 密钥容器... 无法打开 RSA 密钥容器。失败的!
这似乎在某些服务器上运行良好,而在其他一些服务器上却失败了,对于我的生活,我无法弄清楚为什么。
有人有什么想法吗?
在过去的几天里,我一直被一个奇怪的问题所困扰。
尝试创建如下所示的 RSA 密钥容器时(来自 cmd 管理窗口):
aspnet_regiis -pc "MyKeyContainer" -exp
我收到以下错误:
正在创建 RSA 密钥容器... 无法打开 RSA 密钥容器。失败的!
这似乎在某些服务器上运行良好,而在其他一些服务器上却失败了,对于我的生活,我无法弄清楚为什么。
有人有什么想法吗?
看看下面的博客文章。似乎是权限问题。您也可以尝试以管理员身份运行此命令。
I have had this exact issue occur and was able to fix it. To prevent the following error:
"Creating RSA Key Container... The RSA key container could not be opened. Failed!"
message upon creating a new key, you will 1st want to set up permissions on the following directory where the machine keys reside after being creating:
C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys
This is the directory where the machine keys from the command line below get created and stored. The issue is, even as an administrator you may not have access to create and manipulate the keys by default. The easiest thing to do is allow the 'Administrators' group of the machine have 'Modify' permissions to this directory.
Right-click on the 'MachineKeys' directory and ensure the Administrators group has the proper access. See the following post I wrote which is comprehensive on this process: Encrypting Configuration Sections In .NET
One other note, even though the error is produced, technically the key still gets created but is in an invalid state. After fixing the permissions, it's best to delete the key using the -pz
switch and then re-adding using the -pc
switch again, making sure the error does not get displayed and you get a Succeeded! message.