Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用aspnet\u regis对web.config进行查询加密_C#_Asp.net_Encryption_Web Config_Cmd - Fatal编程技术网

C# 使用aspnet\u regis对web.config进行查询加密

C# 使用aspnet\u regis对web.config进行查询加密,c#,asp.net,encryption,web-config,cmd,C#,Asp.net,Encryption,Web Config,Cmd,我的web.config文件中有以下内容—下面显示了其中的一个片段—我只想加密ADConnection部分—请注意,用户ID和密码仅用于测试,以尝试使其正常工作: <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -

我的web.config文件中有以下内容—下面显示了其中的一个片段—我只想加密ADConnection部分—请注意,用户ID和密码仅用于测试,以尝试使其正常工作:

<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>
但是,当我点击“输入”按钮时,只需列出aspnet_regiis可以执行的所有选项,并简要说明aspnet_regiis是一个用于在本地计算机上安装和unistall ASP.NET的管理程序


有什么我遗漏了吗?

所以在使用上面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"

您的路径有空格,我至少要用引号括起来,因为它通常会打断命令行输入。Hi@GrantThomas-这很有用-因为它现在尝试运行加密-尽管我得到了物理路径“C:\Users\Test\Documents\visualstudio 2012\Projects\WebApplication1\WebApplication1\Web.config”的配置,但无法打开。失败!-我没有打开任何我可以看到的文件-我可能会尝试停止IIS并再次运行cmd ok-你不需要在最后有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"