问题标签 [aspnet-regiis.exe]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
1766 浏览

encryption - 导入后无法打开 RSA 密钥容器并授予每个人的访问权限(添加图片)

我正在尝试加密分布在多台服务器上的 Windows 应用程序上的连接字符串(我认为类似于网络场)。连接字符串实际上位于一个名为“ConnectionStrings.config”的单独文件中,我使用我的域/用户帐户作为远程桌面登录来执行此操作,该帐户当前具有管理员权限。

  1. 将我的连接字符串引用到外部文件“ConnectionStrings.config”

    <connectionStrings configSource="ConnectionStrings.config"/>

  2. 将 ConnectionStrings.config 复制到名为 web.config 的新文件中

  3. 添加打开和关闭<configuration>标签
  4. 添加<configProtectedData>部分
  5. 现在我的 web.config 看起来像这样:

    <!-- This file contains the connection string referenced by the app.config file --> <configuration> <configProtectedData> <providers> <add keyContainerName="SecurityKeys" useMachineContainer="false" description="Uses RsaCryptoServiceProvider to encrypt and decrypt" name="AppEncryptionProvider" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </configProtectedData> <connectionStrings> <add name="MyConnectionString" connectionString="Data Source=MyServer; Initial Catalog=MyDatabase;Persist Security Info=True;User ID=**MyId**;Password=**MyPwd**" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>

  6. 在管理控制台中创建容器

    E:\Program Files\MyApplication>aspnet_regiis -pc "SecurityKeys" -exp 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. Creating RSA Key container... Succeeded!

  7. 在管理控制台中加密 web.config

    E:\Program Files\MyApplication>aspnet_regiis -pef "connectionStrings" "." -prov "AppEncryptionProvider" 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... Succeeded!

  8. 将该部分移回应用程序配置文件。

  9. 将加密部分复制回 ConnectionStrings.config 文件:

    <connectionStrings configProtectionProvider="AppEncryptionProvider"> <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#"> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" /> <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#"> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" /> <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> <KeyName>Rsa Key</KeyName> </KeyInfo> <CipherData> <CipherValue>**crazyencryptionstring!**</CipherValue> </CipherData> </EncryptedKey> </KeyInfo> <CipherData> <CipherValue>**anothercrazystring!**</CipherValue> </CipherData> </EncryptedData> </connectionStrings>

  10. 运行应用程序 - 没有问题!!!!

  11. 在管理控制台中导出密钥

    E:\Program Files\MyApplication>aspnet_regiis -px "SecurityKeys" ".\SecurityKeys.xml" -pri 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. Exporting RSA Keys to file... Succeeded!

  12. 使用该应用程序将密钥文件复制到另一台服务器。

  13. 在管理控制台中导入密钥

    E:\Program Files\MyApplication>aspnet_regiis -pi "SecurityKeys" "SecurityKeys.xml" 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. Importing RSA Keys from file.. Succeeded!

  14. 复制新的 ConnectionStrings.config 文件,我认为该文件将使用导入的密钥

  15. 运行应用程序(与我进行导入时相同的登录名) - UGH,失败

    Failed to decrypt using provider 'AppEncryptionProvider'. Error message from the provider: The RSA key container could not be opened. (E:\Program Files\MyApplication\ConnectionStrings.config line 4)

  16. 以管理员身份运行应用程序 - 失败的结果相同。

  17. 将权限更改为非常开放

    E:\Program Files\MyApplication>aspnet_regiis -pa "SecurityKeys" "EVERYONE" -full 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. Adding ACL for access to the RSA Key container... Succeeded!

  18. 运行它并....同样的问题

  19. 寻求帮助!


更多信息

好的,也许 ProcMon 的这个输出会给帮助我的人提供进一步的见解。我添加了一些过滤,并将工作的非加密版本与崩溃的加密版本进行了比较。过滤器设置为仅包括我的应用程序并排除以下任何结果:

  1. 成功

  2. 未找到名称

  3. 文件结束

  4. 重新解析

  5. 只有读者锁定文件

  6. 缓冲区溢出。

这就是我剩下的 - 所有加密的东西!!!显然,dm0747 是我,应用程序在 E:\POWERWeb\General 中有文件

在此处输入图像描述

0 投票
1 回答
1449 浏览

asp.net - 使用 aspnet_regiis.exe 加密 web.config 将欧元符号更改为乱码

在使用 Release Management 部署 WebApplication 后,我正在使用 PowerShell 脚本自动加密 web.config 的某些部分。在这个 PowerShell 脚本中,我使用 aspnet_regiis.exe 为我执行加密,如下所示:

随着$configSection$configPath被正确定义,加密工作成功。可悲的是,它导致未加密部分之一中的欧元符号从 损坏<sharedSettings currencyFormat="{0:€ #,##0}" /><sharedSettings currencyFormat="{0:€ #,##0}" />

我尝试将欧元符号转义为并在我的 web.config 顶部&#8364;设置打开和关闭。encoding="utf-8"这些解决方案都不起作用,除了在加密之前复制所有部分并在之后重新插入未加密部分之外,我能做些什么来防止这种情况再次发生,我有点茫然。

编辑:当此部分也被加密时,网站上显示的文本也“损坏”,这意味着“稍后插入未加密部分”的解决方案无法解决问题出现在加密部分的情况。

0 投票
0 回答
355 浏览

windows-7 - 注册 aspnet_regiis 后应用程序池不工作

我已经安装了 iis 7,然后我检查了 localhost 是否在 .net 2 下工作。检查后工作​​正常,我注册了 aspnet_regiis 以便在他的 .net 4.5 应用程序上工作,但在注册(并允许 .net 4 在 iis 中的 isapi 中)localhost 返回和 503 错误不可用检查事件查看器后,iis 显示的唯一错误如下:

"The worker process for application pool 'DefaultAppPool, encountered an error 'Configuration file is not well-formed XML' trying to read configuration data from file '\\?\C:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\web.config', line number '58'. The data field contains the error code."

只是让您知道,我根本没有更改或修改 web.config 文件,并且在注册 aspnet_regiis 后就全部占用了。

有什么解决办法吗?

0 投票
1 回答
829 浏览

asp.net - server 2012如何检查asp.net注册是否有效?

我想将asp.net注册到我的服务器2012,然后我使用aspnet_regiis.exe -lv检查,它返回下面的结果,它没有说明是否有效..那么这意味着在服务器上注册成功与否?

4.0.30319.0 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll 1.1.4322.0 C:\Windows\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll 4.0.30319.0 C:\Windows\ Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll

这是当我在自己的电脑上检查时,它的状态应该是 Valid.. 1.1.4322.0 Valid C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll

0 投票
1 回答
2973 浏览

.net - 使用 AES256 加密 MachineKey

我花了一段时间在谷歌上搜索它无济于事,所以这比我想象的要棘手,或者我从根本上误解了它是如何工作的。

我的 Web 服务器有一个服务,其 web.config 文件包含一个机器密钥。我想加密它。

加密它是一个简单的 powershell 命令:

这工作正常。它加密。通过相同的方法解密也可以正常工作。但是,它默认为三重 DES 加密。这是机器密钥的加密版本给我的:

我们不希望那样。我们希望 ASPNET_REGIIS 使用 AES 256 进行加密。到目前为止,我的研究告诉我,这可以通过使用加密脚本上的 /PROV 参数指定“ProtectedConfigurationProvider”来完成。这应该参考以下加密提供程序:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

我目前只有一个提供者,默认的 (RsaProtectedConfigurationProvider),它似乎是使用三重 DES 的提供者。

有谁知道需要采取哪些步骤来使用 AES 256 通过 ASPNET_REGIIS 加密 machineKey?我这里有什么大错特错吗?

非常感谢您提供的任何帮助。

0 投票
1 回答
290 浏览

c# - 加密连接字符串 App.config

我尝试使用下面的代码进行加密,但它只能在我的 PC 上使用,其他 PC 无法连接到我 PC 中的 SQL Server。有人帮我吗?非常感谢!!!(我也尝试使用 aspnet_regiis.exe 但有同样的问题)

0 投票
2 回答
1040 浏览

c# - aspnet_regiis.exe 输出结果

我在一个web.config文件中包含一个连接字符串中的加密密码。我不知道密码是什么,因此无法连接到我的数据库。

aspnet_regiis.exe -pdf反对web.config并收到以下信息:

我想我假设密码会显示在屏幕上,或者类似的东西?然后我认为程序可能会创建一个包含信息的日志文件?找不到一个。

我知道我错过了一些基本的东西,我只是不知道它是什么。

0 投票
0 回答
103 浏览

c# - 使用 aspnet_regiis.exe 和 SectionInformation.ProtectSection 的区别

我希望将自定义配置部分加密并放在单独的文件中。

使用aspnet_regiis自定义配置部分需要一些额外的步骤(请参阅这个问题:Using ASPNet_Regiis to encrypt custom configuration section - 你能做到吗?),所以如果我使用自定义程序和 SectionInformation.ProtectSection 可能更实用。

使用 aspnet_regiis.exe 和 SectionInformation.ProtectSection 有区别,还是它们都使用相同的机制来加密配置文件?

0 投票
1 回答
269 浏览

asp.net - 使用 cmd 加密 App.Config 自定义元素

我可以使用该aspnet_regiis.exe命令配置连接字符串加密。现在我创建了配置部分,在该部分中添加了自定义配置元素集合,这将存储连接信息的值。

这是部分创建的代码

这是我的应用程序配置文件。

在应用程序中,我们得到连接字符串的值。由于安全目的,我们无法在 App.config 值中显示数据。然后需要加密以下部分

  1. 这是我使用的第一个命令

    aspnet_regiis.exe -pef "ReplicationConfigurationSection" "C:\Users\mukesh.singh\Documents\Visual Studio 2015\Projects\AML\ExpressSnapSortCreation"

出现错误将文件名“app.config”转换为“Web.config”

为 ReplicationConfigurationSection 创建配置节处理程序时出错:无法加载文件或程序集“ExpressSnapSortCreation”或其依赖项之一。该系统找不到指定的文件。(C:\Users\mukesh.singh\Documents\Visual Studio 2015\Projects\AML\ExpressSnapSortCreation\bin\Debug\web.config 第 4 行)

无法加载文件或程序集“ExpressSnapSortCreation”或其依赖项之一。该系统找不到指定的文件。失败的!

  1. 改变后

无法从程序集“System.Web,版本=4.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a”加载类型“ExpressSnapSortCreation.ServerReplications”。

  1. 我也试过这个组合

    aspnet_regiis.exe -pef "ExpressSnapSortCreation.ServerReplications/ExpressSnapSortCreations" "C:\Users\mukesh.singh\Documents\Visual Studio 2015\Projects\AML\ExpressSnapSortCreation

0 投票
1 回答
3107 浏览

asp.net - 使用 aspnet_regiis -i 时出现“dns server not authoritative for zone”错误

我第一次尝试让 .NET 4.5.1 asp.net 应用程序在我的公司计算机(Windows 7 Enterprise)上运行。Visual Studio 告诉我将 ASP.NET 配置为使用 .NET 4.5。当我aspnet_regiis -i在管理员命令提示符下发出命令时,该命令显示“服务器对区域不具有权威性”消息。我发现的一个建议是竞选 sfc /scannow可能的腐败。它报告没有发现任何问题。我也重启了。

这台机器的 DNS 后缀搜索列表中有一堆服务器。我不认为这有什么不同。

我无法使用 IIS 服务器运行该应用程序,因为它给出了一条错误消息“处理程序“ExtensionlessUrlHandler-Integrated-4.0”在其模块列表中有一个错误的模块“ManagedPipelineHandler””。可能原因:使用了托管处理程序;但是,ASP.NET 未安装或未完全安装。该站点在 IIS Express 下运行良好。

关于如何解决这个问题的任何想法?