簡體   English   中英

Web.config加密錯誤

[英]Web.config Encryption Error

有加密問題。 我向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!

沒有什么對我有用。

有人可以幫忙嗎?

謝謝

這次失敗讓我遇到了同樣的問題:

aspnet_regiis -pa“NetFrameworkConfigurationKey”“{Domain} {Username}”

上面一行返回“未找到RSA密鑰容器”。

要解決此問題,我必須以管理員身份運行命令提示符(打開“開始”>“附件”>然后右鍵單擊“命令提示符”並選擇“以管理員身份運行...”)。 即使我的帳戶是管理員帳戶,我也必須這樣做。

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關於使用受保護配置加密配置信息的教程。 我已經多次使用它並且還沒有問題做過加密。

您需要將“管理員”更改為運行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"

我必須找到安裝證書的文件夾,並在上述命令的錯誤消失之前取得所有權/授予權限。 錯誤說無法找到密鑰容器,但實際上我只是沒有證書的權限。 在我的情況下,我從其他人那里繼承了一台開發機器,並且在運行必要的命令之前需要給自己一些文件權限。

我曾希望通過證書文件夾位置,詳細步驟等給出更詳細的回復,但沒有時間,只是想記下我在我的場景中必須做的事情。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM