0

我的 web.config 文件中有以下内容 - 它的一个片段如下所示 - 我只想加密 ADConnection 部分 - 并注意 UserID 和 Password 仅用于测试以尝试使其正常工作:

<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <ADConnection
   UserID="Test"
   Password="Test1234"
/>
  <connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <pages>

我正在运行以下命令的机器是 64 位 Windows Server 2008 R2。

我已经尝试了以下 - 右键单击​​并以管理员身份运行 CMD。

cd 到:C:\Windows\Microsoft.NET\Framework\v4.0.30319

然后我尝试了以下命令:

aspnet_regiis.exe -pef "ADConnection" C:\Users\Test\Documents\Visual Studio 2012\Projects\WebApplication
1\WebApplication1\Web.config

但是,当我按 Enter 键时,只需列出 aspnet_regiis 可以做什么的所有选项,并简要说明 aspnet_regiis 是一种管理,也用于在本地计算机上安装和卸载 ASP.NET。

有什么我错过的吗?

4

1 回答 1

2

因此,在使用了上面 Grant Thomas 的信息和一些额外的试验和错误之后,我的实际 CMD 应该看起来像(引号中的路径,最后也没有指定 web.config:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -pef "ADConnecti
on" "C:\Users\Test\Documents\Visual Studio 2012\Projects\WebApplication1\We
bApplication1"
于 2013-09-17T09:57:14.477 回答