问题描述
我正在使用以下命令来使用机器密钥来加密我的web.config的一部分(它实际上是.net应用程序的app.config,已重命名为web.config,以便aspnet_regiis可以使用它):
I am using the following command to use a machine key to encrypt part of my web.config (it is actually an app.config for a .net app, renamed to web.config so the aspnet_regiis will work with it):
aspnet_regiis -pef "section-to-encrypt" "C:\inetpub\path-to-web.config\bin\Release" -prov "provider-name"
在运行此代码之前,我先添加<部分.configProtectedData>,这似乎是必需的(它显示为将"provider-name"挂接到机器加密货币上.)
Before running this, I add the section < configProtectedData>, which seems to be required (to hook "provider-name" to machine crypto, it appears).
问题:运行上述命令后,<configSections>已从.config文件中删除,从而损坏了它.
Problem: After running the above command, the < configSections> is removed from the .config file, damaging it.
我在做什么错了?
推荐答案
我有一个刚刚解决的类似问题.如果我插入configProtectedData.configSections部分之前的部分清除了configSections.如果我在configSections部分之后添加它,则不会.
I had a similar issue which I just resolved. If I insert the configProtectedData. section before the configSections section it was wiping out configSections. If I added it after the configSections section it does not.
我正在加密常规的web.config文件,但我认为区别并不重要.
I'm encrypting a regular web.config file but I don't believe that difference matters.
这篇关于" aspnet_regiis -pef"命令删除"< configSections>"web.config部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!