Web.config 加密错误

发布于 2024-08-17 13:29:51 字数 881 浏览 8 评论 0原文

加密有问题。我向所有用户授予了 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!

没有什么对我有用。

有人可以帮忙吗?

谢谢

Having problem with encryption. I gave full permissions to all users to RSA folders. I did

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!

Then I did

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

Followed by

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

Nothing is working for me.

Can anyone help?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

鹿童谣 2024-08-24 13:29:51

我遇到了与此失败相同的问题:

aspnet_regiis -pa“NetFrameworkConfigurationKey”“{域}{用户名}”

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

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

I was getting the same issue with this failing:

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

The above line was returning "The RSA key container was not found."

To fix this issue, I had to run Command Prompt as Administrator (open up Start > Accessories > then right-click Command Prompt and choose Run as administrator...). I had to do this even though my account was an administrator account.

岁月静好 2024-08-24 13:29:51
C:\>aspnet_regiis -pe "appSettings" -location "web.config"
       -prov "RsaProtectedConfigurationProvider"

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

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

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

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

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

C:\>aspnet_regiis -pe "appSettings" -location "web.config"
       -prov "RsaProtectedConfigurationProvider"

In this line your location is incorrect. When you use the -pd switch location is based on IIS's application paths and web.config is assumed as the point of encryption.

So for example if you have an application named "Website 1" and another named "Website 2" in IIS, and you want the web.config in "Website 1" to be encrypted you would use this line:

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

Personally, I found it easier to use the -pef switch as I can point directly to the web app's physical directory.

Follow MSDN's tutorial on Encrypting Configuration Information Using Protected Configuration . I've used it multiple times and have yet to have an issue doing encyrption.

乙白 2024-08-24 13:29:51

您需要将“管理员”更改为 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"

You need to change "administrator" to whatever the account your ASP.NET service is running as. Because, chances are, you aren't running ASP.NET as administrator service account. If you are, then you should reconsider your decision.

For example, here's what I use:

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

or

aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"

Then for encryption, I use:

  aspnet_regiis -pef "connectionStrings"

or

 aspnet_regiis -pef "appSettings"
满地尘埃落定 2024-08-24 13:29:51

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

我本来希望给出更详细的答复,包括证书文件夹位置、详细步骤等,但没有时间,只是想记下我在我的场景中必须做什么。

I had to find the folder where the certs are installed and take ownership/give permissions before the errors with the above commands would go away. The errors said the key container could not be found, but really it was just that I didn't have permissions to the cert. In my case I had inherited a development machine from someone else and needed to give myself permissions to the files before I could run the necessary commands.

I had hoped to give a more detailed response with cert folder locations, detailed steps, etc. but haven't had time and just wanted to note what I had to do in my scenario.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文