“aspnet_regiis -pef ” command removes “ <configSections>” section of web.config

一个人想着一个人 提交于 2020-01-07 03:24:26

问题


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"

Before running this, I add the section < configProtectedData>, which seems to be required (to hook "provider-name" to machine crypto, it appears).

Problem: After running the above command, the < configSections> is removed from the .config file, damaging it.

What am I doing wrong?


回答1:


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.

I'm encrypting a regular web.config file but I don't believe that difference matters.



来源:https://stackoverflow.com/questions/39351945/aspnet-regiis-pef-command-removes-configsections-section-of-web-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!