6

加密有问题。我授予所有用户对 RSA 文件夹的完全权限。我做了

C:\>aspnet_regiis -pe "appSettings" -location "web.config" -prov "RsaProtectedCo
nfigurationProvider"
Encrypting configuration section...
An error occurred executing the configuration section handler for appSettings.

Failed to encrypt the section 'appSettings' using provider 'RsaProtectedConfigur
ationProvider'. Error message from the provider: Object already exists.

Failed!

然后我做了

C:\>aspnet_regiis -pa "NetFrameworkConfigurationKey" "administrator"
Adding ACL for access to the RSA Key container...
The RSA key container was not found.
Failed!

其次是

C:\>aspnet_regiis -pc "NetFrameworkConfigurationKey" -exp
Creating RSA Key container...
The RSA key container could not be opened.
Failed!

没有什么对我有用。

任何人都可以帮忙吗?

谢谢

4

4 回答 4

9

这次失败我遇到了同样的问题:

aspnet_regiis -pa "NetFrameworkConfigurationKey" "{Domain}{Username}"

上面的行返回“找不到 RSA 密钥容器”。

要解决此问题,我必须以管理员身份运行命令提示符(打开开始 > 附件 > 然后右键单击命令提示符并选择以管理员身份运行...)。即使我的帐户是管理员帐户,我也必须这样做。

于 2011-03-09T17:04:05.930 回答
1
C:\>aspnet_regiis -pe "appSettings" -location "web.config"
       -prov "RsaProtectedConfigurationProvider"

在这一行中,您的位置不正确。使用时,-pd开关位置基于 IIS 的应用程序路径,并且 web.config 被假定为加密点。

因此,例如,如果您在 IIS 中有一个名为“Website 1”的应用程序和另一个名为“Website 2”的应用程序,并且您希望对“Website 1”中的 web.config 进行加密,则可以使用以下行:

C:\>aspnet_regiis -pe "appSettings" -location "Website 1"
        -prov "RsaProtectedConfigurationProvider"

就个人而言,我发现使用该开关更容易,-pef因为我可以直接指向 Web 应用程序的物理目录。

遵循 MSDN 关于使用受保护配置加密配置信息的教程。我已经多次使用它并且还没有遇到过加密问题。

于 2010-01-05T17:25:07.890 回答
1

您需要将“管理员”更改为运行 ASP.NET 服务的帐户。因为,很可能,您没有将 ASP.NET 作为管理员服务帐户运行。如果你是,那么你应该重新考虑你的决定。

例如,这是我使用的:

 aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT Authority\Network Service"

或者

aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"

然后对于加密,我使用:

  aspnet_regiis -pef "connectionStrings"

或者

 aspnet_regiis -pef "appSettings"
于 2010-01-05T17:26:07.450 回答
0

在上述命令的错误消失之前,我必须找到安装证书的文件夹并获取所有权/授予权限。错误说找不到密钥容器,但实际上只是我没有证书的权限。就我而言,我从其他人那里继承了一台开发机器,并且需要先授予自己对文件的权限,然后才能运行必要的命令。

我曾希望对 cert 文件夹位置、详细步骤等给出更详细的回复,但没有时间,只想说明我在我的场景中必须做的事情。

于 2012-10-26T21:54:52.257 回答