【问题标题】:aspnet_regiis is not able to find a custom app setting groupaspnet_regiis 找不到自定义应用设置组
【发布时间】:2016-02-02 10:26:42
【问题描述】:

我正在开发一个 asp.net mvc Web 应用程序。我在 web.config 中定义了一个名为 "customAppSettingsGroup" 的自定义部分组:-

<configuration>
        <configSections>
            <sectionGroup name="customAppSettingsGroup">
                <section name="customAppSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
            </sectionGroup>
            <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />


        </configSections>
        <customAppSettingsGroup>
            <customAppSettings>
          <add key="KeyOne" value="*****"/>

            </customAppSettings>
        </customAppSettingsGroup>
......
......
</configuration>

现在我想加密该部分,主要是为了加密 KeyOne 值。所以我写了以下命令:-

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -pe "customAppSett
ingsGroup" -app "/Scanning" -prov "DataProtectionConfigurationProvider"

但我收到以下错误:-

Microsoft (R) ASP.NET RegIIS version 4.0.30319.18408
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation.  All rights reserved.
Encrypting configuration section...
The configuration section 'customAppSettingsGroup' was not found.
Failed!

所以我不确定为什么 commnad 找不到相关的部分?

谢谢

【问题讨论】:

    标签: asp.net asp.net-mvc iis asp.net-mvc-5 data-protection


    【解决方案1】:

    您的问题有两个方面。

    1. 您不能加密部分组。您只能加密部分。因此,您的命令行需要从 customAppSettingsGroup 更改为 customAppSettingsGroup/customAppSettings

    2. regiis 命令必须绑定到定义 customAppSettings 的 DLL。有两种方法可以解决这个问题 - 或者注释掉 web.config 的 configSections 部分中的 sectionGroup 块,或将包含该定义的 DLL 复制到具有 aspnet_regiis.exe 的文件夹中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-20
      • 2011-09-09
      • 2010-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多