问题
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