问题标签 [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 投票
3 回答
2733 浏览

c# - C# - 使用 aspnet_regiis.exe 找不到配置部分错误

我正在尝试对我正在开发的 C# 应用程序的 app.config 文件中的敏感连接字符串信息进行加密。我正在以管理员身份运行的 VS 命令提示符中使用以下命令:

aspnet_regiis.exe -pef "Credentials" "C:\Users\.....\MyProjectFolderDir"

这是我的 app.config 文件的结构:

但是,我不断收到以下错误:

正在加密配置部分... 未找到配置部分“凭据”。失败的!

我怎样才能得到这个来加密我的部分?

0 投票
0 回答
773 浏览

.net - .NET web.config 加密:“无法打开 RSA 密钥容器”

这与 .NET 应用程序的交互使用以及对 app.config 的一部分进行加密有关。

命令:aspnet_regiis -pdf "testSection" "C:\temp"
错误:

我从原始系统导入了加密工具包,没有错误:

我试过添加权限,例如

没有什么帮助。

我以管理员身份以交互方式登录,并在 Win2012-R2 上以同一用户交互方式登录并导入密钥和测试解密。

我希望能够列出存在的加密工具包,但似乎不可能?

我下一步要做什么?

(在原系统上,我可以整天加解密)

0 投票
1 回答
209 浏览

asp.net - “aspnet_regiis -pef”命令删除“" web.config 的部分

我正在使用以下命令来使用机器密钥来加密我的 web.config 的一部分(它实际上是一个 .net 应用程序的 app.config,重命名为 web.config 以便 aspnet_regiis 可以使用它):

在运行它之前,我添加了 <configProtectedData> 部分,这似乎是必需的(似乎将“提供者名称”挂钩到机器加密)。

问题:运行上述命令后,<configSections> 从 .config 文件中删除,损坏了它。

我究竟做错了什么?

0 投票
0 回答
22 浏览

c# - 使用 aspnet_regiis 仅加密 webconfig 文件中 appSettings 下的某些值的最佳策略是什么

我正在尝试使用 aspnet_regiis 仅加密 webconfig 文件中 appSettings 下的一些值,这样做的最佳策略是什么?

0 投票
2 回答
602 浏览

c# - 使用 aspnet_regiis -pef 加密外部文件中的 appSettings

我正在尝试使用 aspnet_regiis -pef 在外部文件中加密 appSettings。有谁如何做到这一点。

我的主要网络配置文件:

外部文件 ExternalAppSettings.config

我只想加密 ExternalAppSettings.config 中的 appsetting 怎么做?

0 投票
1 回答
523 浏览

unit-testing - 在 Visual Studio Team Services 上加密用户名/密码文件 (app.config) 和单元测试

我有一些针对一些被覆盖的 app.config 文件的单元测试。DataProtectionConfigurationProvider每个配置文件都有通过aspnet_regiis.exe使用的加密密码/用户名

在我创建它们的本地机器上,这一切都很好。现在,当这些部署并运行到我们的Visual Studio Team Services并运行构建定义时,针对加密凭据方法的测试会失败,因为:

System.Configuration.ConfigurationErrorsException:无法使用提供程序“DataProtectionConfigurationProvider”解密。来自提供者的错误消息:密钥在指定状态下无效。

我明白这个错误是由于没有在本地机器上运行 app/tests 的 aspnet_regiis.exe 引起的。

我的问题是这里的最佳做法是什么?因为即使我首先针对未加密的 app.config 文件构建了运行 aspnet_regiis.exe(我认为您可以这样做)的 Team Service 构建定义,我仍然会在一段时间内在线存储未加密的数据。

编辑:

答案帮助我使用了我需要使用的标识符,RsaProtectedConfigurationProvider而不是DataProtectionConfigurationProvider我在这里写了一些博客文章来解释我做了什么:

加密 app.config 文件中的凭据

0 投票
2 回答
938 浏览

powershell - 是否有任何用于 ASP.NET IIS 注册 (aspnet_regiis.exe) 的 PowerShell DSC 资源?

我想使用 Powershell DSC 在 Windows Server 2008 R2 机器上安装 ASP.NET 4.x。有这方面的任何 PowerShell DSC 资源吗?

谢谢!

0 投票
1 回答
976 浏览

asp.net - Is it possible to encrypt a config file specified as a configSource from web.config?

I have a custom section in my web.config I need to encrypt. This custom config section uses the configSource attribute to point at a separate config file (as this file is not to be source controlled) and I'd like for this separate config file to be encrypted. I'm not having any luck using aspnet_regiis.exe to encrypt this section.

Is what I'm trying to achieve possible?

My web.config:

My custom configuration file:

I've added aspnet_regiis to my path so I can call it from the root directory of my site. This is the command I'm executing:

The output I get from this command tells me that encrypting was successful

I've found this link that says that it should just work but it doesn't for me..

0 投票
1 回答
244 浏览

c# - 使用从一台服务器导入的密钥解密在另一台服务器上不起作用

我有两台服务器 Windows 2008 R2、服务器 1 和服务器 2。我在 Windows 帐户 1 下的服务器 1 上使用以下命令生成了 RSA 密钥对:

我将 keys.xml 复制到服务器 2。在 Windows 帐户 2 下的服务器 2 上,我运行:

我使用以下 c# 代码进行加密和解密:

现在,当我使用帐户 1 下的同一容器在服务器 1 上加密一个字符串时,如果我尝试在帐户 2 下的服务器 2 上解密它,我会得到:

我加密/解密的应用程序是一个 C# 控制台应用程序。

我注意到服务器 1 和服务器 2 没有相同版本的 aspnet_regiis.exe,一个是:

另一个是:

我期望我可以使用服务器 2 上的相同密钥(即在服务器 1 上导出并在服务器 2 上导入的密钥对)解密在服务器 1 上加密的文本是否不正确?Windows 是否会在导入时以某种方式改变公钥/私钥?

先感谢您!

只是一个更新。基于其他测试,我注意到在不同的 Windows 帐户下使用相同的 RSA 容器加密相同的字符串会导致不同的加密字符串,这在某种程度上是有意义的。这解释了我看到的行为。

0 投票
0 回答
407 浏览

angular - angular2 内置在 AspNet 核心中 - 在 IIS 问题中部署

我在 AspNet Core 1.0 中创建了一个 Angular2 应用程序。我们没有使用任何 AspNet 核心功能,只是希望将 Angular2 应用程序包装在 AspNet 核心应用程序中。

该应用程序在开发模式下运行良好,即在调试模式下。但是当我从 Visual Studio IDE 发布应用程序并复制发布的内容并将其放在 IIS 虚拟文件夹中时,我无法访问该应用程序。我在参考文献中遇到问题,即无法从 Index.html 加载 .JS .CSS 文件 -

"Failed to load resource: the server responded with a status of 404 (Not Found)".

发布后,我可以注意到所有打字稿文件都被转换为 .js 文件,并且所有引用都正确放置。请参阅快照以了解在浏览器控制台中发现的错误。任何想法为什么我会收到此错误以及需要做什么才能在 IIS 中部署并使其工作?在此处输入图像描述

将样式表 href 从 href="css/bootstrap.min.css" 更改为 href="./css/bootstrap.min.css" 后,我收到此错误。 在此处输入图像描述