title: ASPNET_RegIIS cannot encrypt applicationSettings (and some other sections in web.config?
body: <p>I am trying to use ASPNET_RegIIS.exe to encrypt the &lt;applicationSettings&gt; section in web.config.
  I ran Visual Studio Developer Command Prompt as Administrator, and CD to the web application's folder when the web.config is in. Then I ran the command:</p>
  <pre><code>aspnet_regiis.exe -pdf &quot;applicationSettings&quot; .
  </code></pre>
  <p>The result I get was:</p>
  <pre><code>Decrypting configuration section...
  The configuration section 'applicationSettings' was not found.
  Failed!
  </code></pre>
  <p>I definitely have the &lt;applicationSettings&gt; section in the web.config file. So I tried to use the same syntax to encrypt different sections and gathered the results:</p>
  <pre><code>&lt;configSections&gt; Failed.
  &lt;appSettings&gt; Success.
  &lt;connectionStrings&gt; Success.
  &lt;system.web&gt; Failed.
  &lt;runtime&gt; Failed.
  &lt;system.codedom&gt; Success.
  </code></pre>
  <p>So I thought, maybe ASPNET_RegIIS.exe can only encrypted a set of pre-defined section names. To that, I tested by creating a new section with random name.</p>
  <pre><code>&lt;applicationSettingsConax&gt;
  </code></pre>
  <p>To my surprise, it was able to encrypt it! So then I thought, maybe its the settings inside &lt;applicationSettings&gt; that's causing the problem. So I copied all the settings from &lt;applicationSettings&gt; into &lt;applicationSettingsConax&gt; and it was still able to encrypt &lt;applicationSettingsConax&gt;.</p>
  <p>Now I'm really puzzled. why ASPNET_RegIIS.exe cannot encrypt many of the sections in web.config, but can encrypt sections with randomly created names?</p>
  <p>(Yes, I've Googled and found no information. I've read the official MS page <a href="https://docs.microsoft.com/en-us/previous-versions/aspnet/zhhddkxy(v=vs.100)" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/previous-versions/aspnet/zhhddkxy(v=vs.100)</a>, and it doesn't say much there either. No surprise there.)</p>