【问题标题】:ASPNET_RegIIS cannot encrypt applicationSettings (and some other sections in web.config?ASPNET_RegIIS 无法加密 applicationSettings(以及 web.config 中的其他部分?
【发布时间】:2021-09-11 05:14:21
【问题描述】:

我正在尝试使用 ASPNET_RegIIS.exe 来加密 web.config 中的 部分。 我以管理员身份运行 Visual Studio 开发人员命令提示符,并在 web.config 进入时将 CD 放入 Web 应用程序的文件夹。然后我运行命令:

aspnet_regiis.exe -pdf "applicationSettings" .

我得到的结果是:

Decrypting configuration section...
The configuration section 'applicationSettings' was not found.
Failed!

我在 web.config 文件中肯定有 部分。所以我尝试使用相同的语法来加密不同的部分并收集结果:

<configSections> Failed.
<appSettings> Success.
<connectionStrings> Success.
<system.web> Failed.
<runtime> Failed.
<system.codedom> Success.

所以我想,也许 ASPNET_RegIIS.exe 只能加密一组预定义的节名。为此,我通过创建一个随机名称的新部分进行了测试。

<applicationSettingsConax>

令我惊讶的是,它能够加密它!所以我想,也许是 里面的设置导致了这个问题。所以我将 中的所有设置复制到 中,它仍然能够加密 。

现在我真的很困惑。为什么 ASPNET_RegIIS.exe 不能加密 web.config 中的许多部分,但可以加密随机创建名称的部分?

(是的,我用谷歌搜索并没有找到任何信息。我​​已经阅读了官方的 MS 页面https://docs.microsoft.com/en-us/previous-versions/aspnet/zhhddkxy(v=vs.100),它也没有说太多。这不足为奇。)

【问题讨论】:

    标签: encryption web-config


    【解决方案1】:

    在大多数情况下,只要我发布一个问题,我就找到了答案……这一次,从这里开始: https://forums.asp.net/t/1269197.aspx?encrypting+applicationSettings+with+aspnet_regiis

    我需要这样做:

    aspnet_regiis.exe -pef "applicationSettings/GeneralWebApplicationTests.Properties.Settings" .
    

    【讨论】:

      猜你喜欢
      • 2012-10-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2011-12-24
      • 2012-08-31
      • 1970-01-01
      • 1970-01-01
      • 2014-05-31
      相关资源
      最近更新 更多