“aspnet_regiis -pef”命令删除web.config

时间:2016-09-06 14:48:21

标签: asp.net .net aspnet-regiis.exe

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

aspnet_regiis -pef "section-to-encrypt" "C:\inetpub\path-to-web.config\bin\Release" -prov "provider-name"

在运行之前,我添加了部分<似乎需要configProtectedData>(将“provider-name”挂钩到机器加密,它出现了)。

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

我做错了什么?

1 个答案:

答案 0 :(得分:-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.